武汉联特二开

武汉联特科技股份有限公司
Chengliang 5 months ago
parent fd45118dd7
commit d3d6ccde30

@ -1,18 +1,18 @@
package weaver.interfaces.seclinktel.crob;
import com.weaver.general.BaseBean;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.interfaces.seclinktel.entity.po.EducationModePo;
import weaver.interfaces.seclinktel.entity.po.ResourceOtherInfoPo;
import weaver.interfaces.seclinktel.entity.po.WorkInfoModePo;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Author liang.cheng
@ -25,6 +25,7 @@ public class ResourcePersonInfoCron extends BaseCronJob {
public void execute() {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
//1.工作经历
List<WorkInfoModePo> workInfos = new ArrayList<>();
rs.executeQuery("select xm,qgslzsj,gsmc,zw1 from uf_gzjl");
@ -43,25 +44,129 @@ public class ResourcePersonInfoCron extends BaseCronJob {
Function.identity(),
BinaryOperator.maxBy(Comparator.comparing(WorkInfoModePo::getLastCompanyLeaveDate))))
.values());
Map<Integer, WorkInfoModePo> workResultPoMap = workResult.stream()
.collect(Collectors.toMap(WorkInfoModePo::getUserId, workInfo -> workInfo));
//2.教育经历第一学历
//2.教育经历第一学历
List<EducationModePo> educationFirst = new ArrayList<>();
rs.executeQuery("select xm,xl,zy from uf_jxjl where sfwdyxl = 0");
rs.executeQuery("select id,xm,xl,zy from uf_jxjl where sfwdyxl = 0");
while (rs.next()) {
Integer id = Util.getIntValue(rs.getString("id"));
Integer userId = Util.getIntValue(rs.getString("xm"));
Integer firstDegree = Util.getIntValue(rs.getString("xl"));
String firstDegreeMajor = Util.null2String(rs.getString("zy"));
educationFirst.add(EducationModePo.builder().id(id).userId(userId).firstDegree(firstDegree).firstDegreeMajor(firstDegreeMajor).build());
}
List<EducationModePo> educationFirstResult = new ArrayList<>(educationFirst.stream()
.collect(Collectors.toMap(
EducationModePo::getUserId,
e -> e,
(existing, replacement) -> existing.getId() > replacement.getId() ? existing : replacement))
.values());
Map<Integer, EducationModePo> educationFirstMap = educationFirstResult.stream()
.collect(Collectors.toMap(EducationModePo::getUserId, educationModePo -> educationModePo));
//2.教育经历最高学历
List<EducationModePo> educationHighest = new ArrayList<>();
rs.executeQuery("select xm,xl,zy from uf_jxjl where sfwzgxl = 0");
rs.executeQuery("select id,xm,xl,zy from uf_jxjl where sfwzgxl = 0");
while (rs.next()) {
Integer id = Util.getIntValue(rs.getString("id"));
Integer userId = Util.getIntValue(rs.getString("xm"));
Integer highestDegree = Util.getIntValue(rs.getString("xl"));
String highestDegreeMajor = Util.null2String(rs.getString("zy"));
educationHighest.add(EducationModePo.builder().id(id).userId(userId).highestDegree(highestDegree).highestDegreeMajor(highestDegreeMajor).build());
}
List<EducationModePo> educationHighResult = new ArrayList<>(educationHighest.stream()
.collect(Collectors.toMap(
EducationModePo::getUserId,
e -> e,
(existing, replacement) -> existing.getId() > replacement.getId() ? existing : replacement))
.values());
Map<Integer, EducationModePo> educationHighMap = educationHighResult.stream()
.collect(Collectors.toMap(EducationModePo::getUserId, educationModePo -> educationModePo));
List<ResourceOtherInfoPo> otherInfoPos = new ArrayList<>();
List<Integer> uniqueUserIds = getUniqueUserIds(workResult, educationFirstResult, educationHighResult);
uniqueUserIds.forEach(userId -> {
WorkInfoModePo workInfoModePo = workResultPoMap.get(userId);
EducationModePo educationModeFirst = educationFirstMap.get(userId);
EducationModePo educationModeHigh = educationHighMap.get(userId);
ResourceOtherInfoPo build = ResourceOtherInfoPo.builder().id(userId).build();
if (workInfoModePo != null) {
build.setLastWorkunitName(workInfoModePo.getLastWorkunitName());
build.setLastJobName(workInfoModePo.getLastJobName());
}
if (educationModeFirst != null) {
build.setFirstDegree(educationModeFirst.getFirstDegree());
build.setFirstDegreeMajor(educationModeFirst.getFirstDegreeMajor());
}
if (educationModeHigh != null) {
build.setHighestDegree(educationModeHigh.getHighestDegree());
build.setHighestDegreeMajor(educationModeHigh.getHighestDegreeMajor());
}
otherInfoPos.add(build);
});
String scopeId = bb.getPropValue("seclinktel", "scopeid");
String firstDegree = bb.getPropValue("seclinktel", "firstDegree");
String firstDegreeMajor = bb.getPropValue("seclinktel", "firstDegreeMajor");
String highestDegree = bb.getPropValue("seclinktel", "highestDegree");
String highestDegreeMajor = bb.getPropValue("seclinktel", "highestDegreeMajor");
String lastWorkunitName = bb.getPropValue("seclinktel", "lastWorkunitName");
String lastJobName = bb.getPropValue("seclinktel", "lastJobName");
otherInfoPos.forEach(e -> {
//2.插入更新
rs.executeQuery("select count(1) as nums from cus_fielddata where " +
" scope = 'HrmCustomFieldByInfoType' and scopeid = "+scopeId+" and id = ?",e.getId());
rs.next();
int nums = Util.getIntValue(rs.getString("nums"));
if (nums > 0) {
//更新
rs.executeUpdate("update cus_fielddata set "+firstDegree+"=?, "+firstDegreeMajor+"=?, "+highestDegree+"=?, "+highestDegreeMajor+"=?, "+lastWorkunitName+"=?, "+lastJobName+"= ? "+
" where id=? and scope = 'HrmCustomFieldByInfoType' and "+scopeId+" = 1",e.getFirstDegree(),e.getFirstDegreeMajor(),e.getHighestDegree(),e.getHighestDegreeMajor(),e.getLastWorkunitName(),
e.getLastJobName(),e.getId());
}else {
//插入
rs.executeUpdate("insert into cus_fielddata(scope,scopeid,id,"+firstDegree+","+firstDegreeMajor+","+highestDegree+","+highestDegreeMajor+", "+lastWorkunitName+", "+lastJobName+") values(?,?,?,?,?,?,?,?,?)",
"HrmCustomFieldByInfoType",scopeId,e.getId(),e.getFirstDegree(),e.getFirstDegreeMajor(),e.getHighestDegree(),e.getHighestDegreeMajor(),e.getLastWorkunitName(),e.getLastJobName());
}
});
}
public List<Integer> getUniqueUserIds(List<WorkInfoModePo> workResult,List<EducationModePo> educationFirstResult,
List<EducationModePo> educationHighResult) {
List<Integer> userIdsFromEducationFirst = educationFirstResult.stream()
.map(EducationModePo::getUserId)
.collect(Collectors.toList());
List<Integer> userIdsFromWork = workResult.stream()
.map(WorkInfoModePo::getUserId)
.collect(Collectors.toList());
List<Integer> userIdsFromEducationHigh = educationHighResult.stream()
.map(EducationModePo::getUserId)
.collect(Collectors.toList());
return Stream.concat(
Stream.concat(userIdsFromEducationFirst.stream(), userIdsFromWork.stream()),
userIdsFromEducationHigh.stream()
).distinct().collect(Collectors.toList());
}
}

@ -22,11 +22,11 @@ public class EducationModePo {
private Integer userId;
private String firstDegree;
private Integer firstDegree;
private String firstDegreeMajor;
private String highestDegree;
private Integer highestDegree;
private String highestDegreeMajor;

@ -21,11 +21,11 @@ public class ResourceOtherInfoPo {
private String birthday;
private String firstDegree;
private Integer firstDegree;
private String firstDegreeMajor;
private String highestDegree;
private Integer highestDegree;
private String highestDegreeMajor;

Loading…
Cancel
Save