五院杭州中心 引入产品功能 人员简历接口开发

五院杭州中心
Chengliang 2 months ago
parent 93ee7661b5
commit a23e01ab92

@ -1,5 +1,21 @@
#\u4E1A\u52A1\u804C\u52A1\u5E8F\u5217
postionType=field49
#业务职务序列(工作信息)
postionType=field65
#业务职务层级(工作信息)
postion=field67
#民族(个人信息)
nation=field59
#入党时间(个人信息)
joinPartyDate=field42
#首次参加工作时间(工作信息)
workStartDate=field42
#高层次人才类别(工作信息)
highPersonType=field17
#专业技术职务
jobCall=field42
#\u4E1A\u52A1\u804C\u52A1\u5C42\u7EA7
postion=field50

@ -0,0 +1,12 @@
package com.api.wysecond.web;
import javax.ws.rs.Path;
/**
* @author apple
*/
@Path("/wy/second/personnelresume")
public class PersonnelResumeAction extends com.engine.wysecond.web.PersonnelResumeAction {
}

@ -0,0 +1,30 @@
package com.engine.wysecond.entity.resume;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EducationInfo {
private String xl;
private String xw;
private String byyx;
private String xxzy;
private String sfzgxl;
private String sfqrzzgxl;
private String sfzgxw;
private String sfqrzzgxw;
}

@ -0,0 +1,30 @@
package com.engine.wysecond.entity.resume;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2025/2/17 15:05
* @Description:
* @Version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EducationOrWorkInfo {
private String startDate;
private String startAndEndDate;
private String address;
private String content;
private String level;
}

@ -0,0 +1,111 @@
package com.engine.wysecond.entity.resume;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.IOUtils;
import weaver.file.ImageFileManager;
import weaver.general.GCONST;
import weaver.general.Util;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.Base64;
/**
* @Author liang.cheng
* @Date 2025/2/17 14:56
* @Description:
* @Version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PersonnelResumePo {
private Integer id;
private String workcode;
private String lastName;
private String sex;
private String birthday;
private String resourceImageId;
private String nation;
private String nativePlace;
private String companyStartDate;
private String joinPartyDate;
private String workStartDate;
private String highPersonType;
private String department;
private String jobTitle;
private String postionLevel;
private String fullHighEducational;
private String fullHighMajor;
private String fullHighSchool;
private String fullHighDegree;
private String notfullHighEducational;
private String notfullHighMajor;
private String notfullHighSchool;
private String notfullHighDegree;
public String getSex() {
if ("1".equals(sex)) {
return "女";
}
return "男";
}
public String getImage() {
if (StringUtils.isBlank(resourceImageId)) {
return "";
}
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(Util.getIntValue(resourceImageId));
InputStream inputStream = manager.getInputStream();
String imageStr = "";
try {
String outPutPath = GCONST.getRootPath() + "hrm" + File.separator + "import" + File.separator + "template" + File.separator
+ manager.getImageFileName();
File f = new File(outPutPath);
if (!f.exists()) {
String substring = outPutPath.substring(0, outPutPath.lastIndexOf(File.separator));
File file = new File(substring);
if (file.mkdirs()) {
boolean newFile = f.createNewFile();
if (!newFile) {
throw new IOException(outPutPath + "文件创建失败");
}
}
}
Thumbnails.of(inputStream).forceSize(100, 120).toFile(f);
InputStream fileInputStream = Files.newInputStream(f.toPath());
imageStr = "data:image/" + manager.getImageFileType() + ";base64," + Base64.getEncoder().encodeToString(IOUtils.toByteArray(fileInputStream));
// 删除文件
f.delete();
} catch (IOException e) {
throw new RuntimeException(e);
}
return imageStr;
}
public String getBirthday() {
if (StringUtils.isBlank(birthday)) {
return "";
}else {
return birthday.substring(0,7);
}
}
}

@ -0,0 +1,25 @@
package com.engine.wysecond.entity.resume;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author liang.cheng
* @Date 2025/2/17 15:00
* @Description:
* @Version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PersonnelResumeTable {
private List<PersonnelResumeTd> columns;
private List<List<PersonnelResumeTd>> datas;
}

@ -0,0 +1,25 @@
package com.engine.wysecond.entity.resume;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2025/2/17 15:01
* @Description:
* @Version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PersonnelResumeTd {
private String value;
private Integer colspans;
private Integer rowspans;
}

@ -0,0 +1,45 @@
package com.engine.wysecond.service;
import com.engine.wysecond.entity.resume.PersonnelResumePo;
import com.engine.wysecond.entity.resume.PersonnelResumeTable;
import java.util.List;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2025/2/17 14:41
* @Description:
* @Version 1.0
*/
public interface PersonnelResumeService {
/**
* @Description:
* @Author: liang.cheng
* @Date: 2025/2/17 14:53
* @param: [resourceId]
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> getResumeList(String resourceId);
/**
* @Description: id
* @Author: liang.cheng
* @Date: 2025/2/18 10:43
* @param: [resourceId]
* @return: com.engine.shkjsecond.entity.PersonnelResumePo
*/
PersonnelResumePo peopleMainInfo(String resourceId);
/**
* id
* @param resourceId
* @return
*/
List<PersonnelResumeTable> peopleDetailInfo(String resourceId);
}

@ -0,0 +1,245 @@
package com.engine.wysecond.service.impl;
import com.engine.core.impl.Service;
import com.engine.wysecond.entity.resume.*;
import com.engine.wysecond.service.PersonnelResumeService;
import lombok.SneakyThrows;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.job.EducationLevelComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import java.util.*;
/**
* @Author liang.cheng
* @Date 2025/2/17 14:41
* @Description:
* @Version 1.0
*/
public class PersonnelResumeServiceImpl extends Service implements PersonnelResumeService {
@Override
public Map<String, Object> getResumeList(String resourceId) {
Map<String, Object> resultMap = new HashMap<>(8);
PersonnelResumePo personnelResumePo = peopleMainInfo(resourceId);
resultMap.put("workcode",personnelResumePo.getWorkcode());
resultMap.put("lastName",personnelResumePo.getLastName());
resultMap.put("sex",personnelResumePo.getSex());
resultMap.put("birthday",personnelResumePo.getBirthday());
resultMap.put("resourceImageId",personnelResumePo.getImage());
resultMap.put("nation",personnelResumePo.getNation());
resultMap.put("nativePlace",personnelResumePo.getNativePlace());
resultMap.put("companyStartDate",personnelResumePo.getCompanyStartDate());
resultMap.put("joinPartyDate",personnelResumePo.getJoinPartyDate());
resultMap.put("highPersonType",personnelResumePo.getHighPersonType());
resultMap.put("department",personnelResumePo.getDepartment());
resultMap.put("jobTitle",personnelResumePo.getJobTitle());
resultMap.put("postionLevel",personnelResumePo.getPostionLevel());
resultMap.put("fullHighEducational",personnelResumePo.getFullHighEducational());
resultMap.put("fullHighMajor",personnelResumePo.getFullHighMajor());
resultMap.put("fullHighSchool",personnelResumePo.getFullHighSchool());
resultMap.put("fullHighDegree",personnelResumePo.getFullHighDegree());
resultMap.put("notfullHighEducational",personnelResumePo.getNotfullHighEducational());
resultMap.put("notfullHighMajor",personnelResumePo.getNotfullHighMajor());
resultMap.put("notfullHighSchool",personnelResumePo.getNotfullHighSchool());
resultMap.put("notfullHighDegree",personnelResumePo.getNotfullHighDegree());
//表格拓展
resultMap.put("tables", peopleDetailInfo(resourceId));
return resultMap;
}
@Override
public List<PersonnelResumeTable> peopleDetailInfo(String resourceId) {
List<PersonnelResumeTable> tables = new ArrayList<>();
List<PersonnelResumeTd> columns = new ArrayList<>();
List<List<PersonnelResumeTd>> datas = new ArrayList<>();
//1.教育和工作经历经历
LinkedList<EducationOrWorkInfo> educationInfos = selectEducationOrWorkInfo(resourceId);
//按照起始时间排序
//增加空行
educationInfos.add(EducationOrWorkInfo.builder().build());
for (EducationOrWorkInfo educationInfo : educationInfos) {
List<PersonnelResumeTd> educTr = new ArrayList<>();
educTr.add(PersonnelResumeTd.builder().colspans(1).value(educationInfo.getStartAndEndDate()).rowspans(1).build());
educTr.add(PersonnelResumeTd.builder().colspans(2).value(educationInfo.getAddress()).rowspans(1).build());
educTr.add(PersonnelResumeTd.builder().colspans(1).value(educationInfo.getContent()).rowspans(1).build());
educTr.add(PersonnelResumeTd.builder().colspans(3).value(educationInfo.getLevel()).rowspans(1).build());
datas.add(educTr);
}
columns.add(PersonnelResumeTd.builder().colspans(1).value("简历").rowspans(educationInfos.size()+1).build());
columns.add(PersonnelResumeTd.builder().colspans(1).value("起始时间-结束时间").rowspans(1).build());
columns.add(PersonnelResumeTd.builder().colspans(2).value("单位/学校(从高中毕业后开始填写)").rowspans(1).build());
columns.add(PersonnelResumeTd.builder().colspans(1).value("岗位/专业").rowspans(1).build());
columns.add(PersonnelResumeTd.builder().colspans(3).value("业务职务层级/学历").rowspans(1).build());
tables.add(PersonnelResumeTable.builder().columns(columns).datas(datas).build());
return tables;
}
private LinkedList<EducationOrWorkInfo> selectEducationOrWorkInfo(String resourceId) {
RecordSet rs = new RecordSet();
EducationLevelComInfo eduComInfo = new EducationLevelComInfo();
LinkedList<EducationOrWorkInfo> educationOrWorkInfos = new LinkedList<>();
//教育经历
rs.executeQuery("select rxsj,bysj,byyx,xxzy,xl from uf_jxjl where xm = ?",resourceId);
while (rs.next()) {
String date = Util.null2String(rs.getString("ksrq")) +" - " + Util.null2String(rs.getString("jsrq"));
// String educationalAndDegree = eduComInfo.getEducationLevelname(Util.null2String(rs.getString("xl"))) +" / "
// + selectWorkflowItem("xw","uf_jyjl",Util.getIntValue(rs.getString("xw")),String.valueOf(user.getLanguage()));
educationOrWorkInfos.add(EducationOrWorkInfo.builder()
.startDate(Util.null2String(rs.getString("rxsj")))
.startAndEndDate(date)
.address(Util.null2String(rs.getString("byyx")))
.content(Util.null2String(rs.getString("xxzy")))
.level(Util.null2String(rs.getString("xl")))
.build());
}
//工作经历
rs.executeQuery("select qssj,zzsj,lldw,rzgw,zwzwdj from uf_gzjl where xm = ?",resourceId);
while (rs.next()) {
String date = Util.null2String(rs.getString("qssj")) +" - " + Util.null2String(rs.getString("zzsj"));
// String educationalAndDegree = eduComInfo.getEducationLevelname(Util.null2String(rs.getString("xl"))) +" / "
// + selectWorkflowItem("xw","uf_jyjl",Util.getIntValue(rs.getString("xw")),String.valueOf(user.getLanguage()));
educationOrWorkInfos.add(EducationOrWorkInfo.builder()
.startDate(Util.null2String(rs.getString("qssj")))
.startAndEndDate(date)
.address(Util.null2String(rs.getString("lldw")))
.content(Util.null2String(rs.getString("rzgw")))
.level(Util.null2String(rs.getString("zwzwdj")))
.build());
}
return educationOrWorkInfos;
}
@SneakyThrows
@Override
public PersonnelResumePo peopleMainInfo(String resourceId) {
RecordSet rs = new RecordSet();
String nation = rs.getPropValue("wysecond", "nation");
String joinPartyDate = rs.getPropValue("wysecond", "joinPartyDate");
String workStartDate = rs.getPropValue("wysecond", "workStartDate");
String highPersonType = rs.getPropValue("wysecond", "highPersonType");
String jobCall = rs.getPropValue("wysecond", "jobCall");
String postion = rs.getPropValue("wysecond", "postion");
DepartmentComInfo dept = new DepartmentComInfo();
JobTitlesComInfo job = new JobTitlesComInfo();
rs.executeQuery("SELECT h.id, workcode, lastname, sex, birthday, resourceimageid, b."+nation+" as nation, nativeplace, \n" +
" companystartdate, b."+joinPartyDate+" as joinPartyDate, c."+workStartDate+" as workStartDate, c."+highPersonType+" as highPersonType, \n" +
" departmentid, jobTitle, c."+postion+" as postion FROM hrmresource h \n" +
" LEFT JOIN cus_fielddata b on b.id = h.id and b.scopeid = 1 and b.scope = 'HrmCustomFieldByInfoType' \n" +
" LEFT JOIN cus_fielddata c on c.id = h.id and c.scopeid = 3 and c.scope = 'HrmCustomFieldByInfoType' \n" +
"where h.id = ?",resourceId);
PersonnelResumePo personnelResumePo = PersonnelResumePo.builder().build();
if (rs.next()) {
String id = Util.null2String(rs.getString("id"));
personnelResumePo.setWorkcode(Util.null2String(rs.getString("workcode")));
personnelResumePo.setLastName(Util.null2String(rs.getString("lastname")));
personnelResumePo.setSex(Util.null2String(rs.getString("sex")));
personnelResumePo.setBirthday(Util.null2String(rs.getString("birthday")));
personnelResumePo.setResourceImageId(Util.null2String(rs.getString("resourceimageid")));
personnelResumePo.setNation(selectNationName(Util.null2String(rs.getString("nation"))));
personnelResumePo.setNativePlace(Util.null2String(rs.getString("nativeplace")));
personnelResumePo.setCompanyStartDate(Util.null2String(rs.getString("companystartdate")));
personnelResumePo.setJoinPartyDate(Util.null2String(rs.getString("joinPartyDate")));
personnelResumePo.setWorkStartDate(Util.null2String(rs.getString("workStartDate")));
personnelResumePo.setHighPersonType(selectItemValue(highPersonType,Util.getIntValue(rs.getString("highPersonType")),String.valueOf(user.getLanguage())));
personnelResumePo.setDepartment(dept.getDepartmentName(Util.null2String(rs.getString("departmentid"))));
personnelResumePo.setJobTitle(job.getJobTitlesname(Util.null2String(rs.getString("jobTitle"))));
personnelResumePo.setPostionLevel(selectPostionLevel(Util.null2String(rs.getString("postion"))));
//学历学位
List<EducationInfo> educationInfos = selectEducInfo(id);
}
return personnelResumePo;
}
private String selectItemValue(String field, Integer selectValue,String language) {
field = field.substring("field".length());
RecordSet rs = new RecordSet();
rs.executeQuery("select selectname from cus_selectitem where fieldid = ? and selectvalue = ?",field,selectValue);
rs.next();
return Util.formatMultiLang(Util.null2String(rs.getString("selectname")),language);
}
private String selectWorkflowItem(String fieldName, String tableName,Integer selectValue,String language) {
RecordSet rs = new RecordSet();
Integer fieldId = null;
rs.executeQuery("select id from workflow_billfield where billid = (select id from workflow_bill where tablename = '"+tableName+"') \n" +
" and fieldname = '"+fieldName+"'");
if (rs.next()) {
fieldId = Util.getIntValue(rs.getString("id"));
}
rs.executeQuery("select selectname from workflow_selectitem where fieldid = ? and selectvalue = ?",fieldId,selectValue);
rs.next();
return Util.formatMultiLang(Util.null2String(rs.getString("selectname")),language);
}
private String selectNationName(String value) {
RecordSet rs = new RecordSet();
rs.executeQuery("select mz from uf_mz_ where id = ?",value);
rs.next();
return Util.null2String(rs.getString("mz"));
}
private String selectPostionLevel(String value) {
RecordSet rs = new RecordSet();
rs.executeQuery("select ywzwcj from uf_ywzwcj where id = ?",value);
rs.next();
return Util.null2String(rs.getString("ywzwcj"));
}
private List<EducationInfo> selectEducInfo(String resourceId) {
List<EducationInfo> educationInfos = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.executeQuery("select xl,xw,byyx,xxzy,sfzgxw,sfqrzzgxw,sfzgxl,sfqrzzgxl from uf_jxjl where xm = ?",resourceId);
while (rs.next()) {
educationInfos.add(EducationInfo.builder()
.xl(Util.null2String(rs.getString("xl")))
.xw(Util.null2String(rs.getString("xw")))
.byyx(Util.null2String(rs.getString("byyx")))
.xxzy(Util.null2String(rs.getString("xxzy")))
.sfzgxw(Util.null2String(rs.getString("sfzgxw")))
.sfqrzzgxw(Util.null2String(rs.getString("sfqrzzgxw")))
.sfzgxl(Util.null2String(rs.getString("sfzgxl")))
.sfqrzzgxl(Util.null2String(rs.getString("sfqrzzgxl")))
.build());
}
return educationInfos;
}
}

@ -0,0 +1,49 @@
package com.engine.wysecond.web;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.engine.common.util.ServiceUtil;
import com.engine.wysecond.service.PersonnelResumeService;
import com.engine.wysecond.service.impl.PersonnelResumeServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2025/2/17 14:40
* @Description:
* @Version 1.0
*/
public class PersonnelResumeAction {
private PersonnelResumeService getService(User user) {
return ServiceUtil.getService(PersonnelResumeServiceImpl.class, user);
}
@GET
@Path("/getResumeList")
@Produces(MediaType.TEXT_PLAIN)
public String getResumeList(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("resourceId") String resourceId){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("resumeList",getService(user).getResumeList(resourceId));
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
}
}
Loading…
Cancel
Save