1.岗位矩阵图合并优化;2.积分库更新
This commit is contained in:
parent
92ceea58dc
commit
ea6eb3c355
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.engine.wysecond.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author liang.cheng
|
||||||
|
* @Date 2025/4/2 17:53
|
||||||
|
* @Description:
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PostionPoints {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer resourceId;
|
||||||
|
|
||||||
|
private Integer changeType;
|
||||||
|
|
||||||
|
private String jobStartDate;
|
||||||
|
|
||||||
|
private String jobYears;
|
||||||
|
|
||||||
|
private Integer points;
|
||||||
|
|
||||||
|
private Integer year;
|
||||||
|
|
||||||
|
private Integer checkResult;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
||||||
educationInfos.sort(Comparator.comparing(EducationOrWorkInfo::getStartDate));
|
educationInfos.sort(Comparator.comparing(EducationOrWorkInfo::getStartDate));
|
||||||
|
|
||||||
//增加空行
|
//增加空行
|
||||||
educationInfos.add(EducationOrWorkInfo.builder().build());
|
//educationInfos.add(EducationOrWorkInfo.builder().build());
|
||||||
for (EducationOrWorkInfo educationInfo : educationInfos) {
|
for (EducationOrWorkInfo educationInfo : educationInfos) {
|
||||||
List<PersonnelResumeTd> educTr = new ArrayList<>();
|
List<PersonnelResumeTd> educTr = new ArrayList<>();
|
||||||
educTr.add(PersonnelResumeTd.builder().colspans(2).value(educationInfo.getStartAndEndDate()).rowspans(1).build());
|
educTr.add(PersonnelResumeTd.builder().colspans(2).value(educationInfo.getStartAndEndDate()).rowspans(1).build());
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
|
|
||||||
//2.报表岗位层级数据
|
//2.报表岗位层级数据
|
||||||
LinkedList<Postion> tops = new LinkedList<>();
|
LinkedList<Postion> tops = new LinkedList<>();
|
||||||
rs.executeQuery("select id,ywzwxl,ywzwcj from uf_ywzwcj");
|
rs.executeQuery("select a.id,a.ywzwxl,a.ywzwcj,b.ywzwcjywzd from uf_ywzwcj a left join uf_ywjsglgx b on a.id = b.ywzwcj where a.ywzwxl = 2");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
tops.add(Postion.builder()
|
tops.add(Postion.builder()
|
||||||
.id(Util.null2String(rs.getString("id")))
|
.id(Util.null2String(rs.getString("id"))+","+Util.null2String(rs.getString("ywzwcjywzd")))
|
||||||
.postionType(Util.getIntValue(rs.getString("ywzwxl")))
|
.postionType(Util.getIntValue(rs.getString("ywzwxl")))
|
||||||
.postionName(Util.null2String(rs.getString("ywzwcj")))
|
.postionName(Util.null2String(rs.getString("ywzwcj")).replaceAll("(技术)", "$1(业务)"))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,8 +61,9 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
if (fDatasAll.size() > 0) {
|
if (fDatasAll.size() > 0) {
|
||||||
for (int i = 0; i < tops.size(); i++) {
|
for (int i = 0; i < tops.size(); i++) {
|
||||||
Postion postion = tops.get(i);
|
Postion postion = tops.get(i);
|
||||||
|
String[] parts = postion.getId().trim().split("\\s*,\\s*");
|
||||||
List<ResourcesPo> collect = fDatasAll.stream()
|
List<ResourcesPo> collect = fDatasAll.stream()
|
||||||
.filter(po -> postion.getId().equals(po.getPostion()))
|
.filter(po -> parts[1].equals(po.getPostion()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
String names = collect.stream()
|
String names = collect.stream()
|
||||||
.map(ResourcesPo::getResource)
|
.map(ResourcesPo::getResource)
|
||||||
|
|
@ -83,8 +84,9 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
if (sDatasAll.size() > 0) {
|
if (sDatasAll.size() > 0) {
|
||||||
for (int i = 0; i < tops.size(); i++) {
|
for (int i = 0; i < tops.size(); i++) {
|
||||||
Postion postion = tops.get(i);
|
Postion postion = tops.get(i);
|
||||||
|
String[] parts = postion.getId().trim().split("\\s*,\\s*");
|
||||||
List<ResourcesPo> collect = sDatasAll.stream()
|
List<ResourcesPo> collect = sDatasAll.stream()
|
||||||
.filter(po -> postion.getId().equals(po.getPostion()))
|
.filter(po -> parts[0].equals(po.getPostion()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
String names = collect.stream()
|
String names = collect.stream()
|
||||||
.map(ResourcesPo::getResource)
|
.map(ResourcesPo::getResource)
|
||||||
|
|
@ -119,17 +121,15 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
LinkedList<Integer> zndatas = new LinkedList<>();
|
LinkedList<Integer> zndatas = new LinkedList<>();
|
||||||
for (int i = 0; i < tops.size(); i++) {
|
for (int i = 0; i < tops.size(); i++) {
|
||||||
Postion postion = tops.get(i);
|
Postion postion = tops.get(i);
|
||||||
rs.executeQuery("select xm,rbywzwcjqssj from uf_ywzwxx where ywzwxl = 1 " +
|
String[] parts = postion.getId().trim().split("\\s*,\\s*");
|
||||||
" and ywzwcj = ? and rbywzwcjqssj is not null",postion.getId());
|
int size = (int) resourcesPoList.stream()
|
||||||
List<ResourcesPo> resourcesPos = new ArrayList<>();
|
.filter(res ->
|
||||||
while (rs.next()) {
|
Objects.equals(res.getPostion(), parts[1]) &&
|
||||||
resourcesPos.add(ResourcesPo.builder()
|
Objects.equals(res.getPostionType(), "1")
|
||||||
.resourceId(Util.null2String(rs.getString("xm")))
|
)
|
||||||
.workDate(Util.null2String(rs.getString("rbywzwcjqssj"))).build());
|
.count();
|
||||||
}
|
|
||||||
|
|
||||||
List<ResourcesPo> filterAll = filterClosestWorkDate(resourcesPos);
|
zndatas.add(size);
|
||||||
zndatas.add(filterAll.size());
|
|
||||||
//名单列 增加null代替不展示
|
//名单列 增加null代替不展示
|
||||||
zndatas.add(null);
|
zndatas.add(null);
|
||||||
if (i == tops.size() - 1) {
|
if (i == tops.size() - 1) {
|
||||||
|
|
@ -140,7 +140,7 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
zndatas.add(znSums);
|
zndatas.add(znSums);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
footers.add(PeopleSums.builder().type("职能管理序列").datas(zndatas).build());
|
footers.add(PeopleSums.builder().type("职能管理序列").datas(zndatas).build());
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -150,17 +150,14 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
int zjSums = 0;
|
int zjSums = 0;
|
||||||
for (int i = 0; i < tops.size(); i++) {
|
for (int i = 0; i < tops.size(); i++) {
|
||||||
Postion postion = tops.get(i);
|
Postion postion = tops.get(i);
|
||||||
|
String[] parts = postion.getId().trim().split("\\s*,\\s*");
|
||||||
rs.executeQuery("select xm,rbywzwcjqssj from uf_ywzwxx where ywzwcj = ? and rbywzwcjqssj is not null",postion.getId());
|
int size = (int) resourcesPoList.stream()
|
||||||
List<ResourcesPo> resourcesPos = new ArrayList<>();
|
.filter(res ->
|
||||||
while (rs.next()) {
|
Objects.equals(res.getPostion(), parts[0]) ||
|
||||||
resourcesPos.add(ResourcesPo.builder()
|
Objects.equals(res.getPostion(), parts[1])
|
||||||
.resourceId(Util.null2String(rs.getString("xm")))
|
)
|
||||||
.workDate(Util.null2String(rs.getString("rbywzwcjqssj"))).build());
|
.count();
|
||||||
}
|
zjdatas.add(size);
|
||||||
|
|
||||||
List<ResourcesPo> filterAll = filterClosestWorkDate(resourcesPos);
|
|
||||||
zjdatas.add(filterAll.size());
|
|
||||||
//名单列 增加null代替不展示
|
//名单列 增加null代替不展示
|
||||||
zjdatas.add(null);
|
zjdatas.add(null);
|
||||||
|
|
||||||
|
|
@ -174,21 +171,19 @@ public class PostionMatrixServiceImpl extends Service implements PostionMatrixSe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//2.专业管理序列
|
//2.专业技术序列
|
||||||
LinkedList<Integer> zydatas = new LinkedList<>();
|
LinkedList<Integer> zydatas = new LinkedList<>();
|
||||||
for (int i = 0; i < tops.size(); i++) {
|
for (int i = 0; i < tops.size(); i++) {
|
||||||
Postion postion = tops.get(i);
|
Postion postion = tops.get(i);
|
||||||
rs.executeQuery("select xm,rbywzwcjqssj from uf_ywzwxx where ywzwxl = 2 " +
|
String[] parts = postion.getId().trim().split("\\s*,\\s*");
|
||||||
" and ywzwcj = ? and rbywzwcjqssj is not null",postion.getId());
|
int size = (int) resourcesPoList.stream()
|
||||||
List<ResourcesPo> resourcesPos = new ArrayList<>();
|
// 空安全比较(支持字段值为null的情况)
|
||||||
while (rs.next()) {
|
.filter(res ->
|
||||||
resourcesPos.add(ResourcesPo.builder()
|
Objects.equals(res.getPostion(), parts[0]) &&
|
||||||
.resourceId(Util.null2String(rs.getString("xm")))
|
Objects.equals(res.getPostionType(), "2")
|
||||||
.workDate(Util.null2String(rs.getString("rbywzwcjqssj"))).build());
|
)
|
||||||
}
|
.count();
|
||||||
|
zydatas.add(size);
|
||||||
List<ResourcesPo> filterAll = filterClosestWorkDate(resourcesPos);
|
|
||||||
zydatas.add(filterAll.size());
|
|
||||||
//名单列 增加null代替不展示
|
//名单列 增加null代替不展示
|
||||||
zydatas.add(null);
|
zydatas.add(null);
|
||||||
if (i == tops.size() - 1) {
|
if (i == tops.size() - 1) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
package weaver.interfaces.wysecond;
|
||||||
|
|
||||||
|
import com.engine.wysecond.entity.PostionPoints;
|
||||||
|
import com.weaver.general.Util;
|
||||||
|
import weaver.common.DateUtil;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author liang.cheng
|
||||||
|
* @Date 2025/4/1 18:00
|
||||||
|
* @Description: 业务职务积分库更新
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public class PostionPointsUpdateCron extends BaseCronJob {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
List<PostionPoints> pointsList = new ArrayList<>();
|
||||||
|
rs.executeQuery("select id,xm,zwdzlx,rzxzwsxrq,rznx,jftj from uf_yezwjfk");
|
||||||
|
while (rs.next()) {
|
||||||
|
pointsList.add(PostionPoints.builder()
|
||||||
|
.id(Util.getIntValue(rs.getString("id")))
|
||||||
|
.resourceId(Util.getIntValue(rs.getString("xm")))
|
||||||
|
.changeType(Util.getIntValue(rs.getString("zwdzlx")))
|
||||||
|
.jobStartDate(Util.null2String(rs.getString("rzxzwsxrq")))
|
||||||
|
.jobYears(Util.null2String(rs.getString("rznx")))
|
||||||
|
.points(Util.getIntValue(rs.getString("jftj"),0))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<PostionPoints> checkList = new ArrayList<>();
|
||||||
|
String year = DateUtil.getYear();
|
||||||
|
rs.executeQuery("select id,xm,khgzq,khjg from uf_khxx where khgzq = ?",year);
|
||||||
|
while (rs.next()) {
|
||||||
|
checkList.add(PostionPoints.builder()
|
||||||
|
.id(Util.getIntValue(rs.getString("id")))
|
||||||
|
.resourceId(Util.getIntValue(rs.getString("xm")))
|
||||||
|
.year(Util.getIntValue(rs.getString("khgzq")))
|
||||||
|
.checkResult(Util.getIntValue(rs.getString("khjg")))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理考核结果表数据,按xm分组,筛选最新记录
|
||||||
|
Map<Integer, PostionPoints> resultMap = checkList.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
PostionPoints::getResourceId,
|
||||||
|
Collectors.collectingAndThen(
|
||||||
|
Collectors.maxBy(
|
||||||
|
Comparator.comparingInt(PostionPoints::getYear)
|
||||||
|
.thenComparingInt(PostionPoints::getId)
|
||||||
|
.reversed()
|
||||||
|
),
|
||||||
|
optional -> optional.orElse(null)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
//合并
|
||||||
|
pointsList.removeIf(point -> {
|
||||||
|
PostionPoints matchedPoint = resultMap.get(point.getResourceId());
|
||||||
|
if (matchedPoint == null) {
|
||||||
|
return true; // 如果在 resultMap 中找不到对应元素,返回 true 表示移除该元素
|
||||||
|
}
|
||||||
|
if (matchedPoint.getYear() != null) {
|
||||||
|
point.setYear(matchedPoint.getYear());
|
||||||
|
}
|
||||||
|
if (matchedPoint.getCheckResult() != null) {
|
||||||
|
point.setCheckResult(matchedPoint.getCheckResult());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//积分统计 任职年限计算
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
// 获取当前日期
|
||||||
|
Date currentDate = new Date();
|
||||||
|
|
||||||
|
for (PostionPoints point : pointsList) {
|
||||||
|
try {
|
||||||
|
// 计算任职年限
|
||||||
|
Date startDate = sdf.parse(point.getJobStartDate());
|
||||||
|
long diffInMillis = currentDate.getTime() - startDate.getTime();
|
||||||
|
long diffInDays = diffInMillis / (1000 * 60 * 60 * 24);
|
||||||
|
double years = (double) diffInDays / 365;
|
||||||
|
point.setJobYears(String.format("%.2f", years));
|
||||||
|
|
||||||
|
// 根据 checkResult 获取额外积分
|
||||||
|
int extraPoints;
|
||||||
|
switch (point.getCheckResult()) {
|
||||||
|
case 0:
|
||||||
|
extraPoints = 3;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
extraPoints = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
extraPoints = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
extraPoints = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (point.getChangeType() == 0) {
|
||||||
|
point.setPoints(extraPoints);
|
||||||
|
} else if (point.getChangeType() == 1 || point.getChangeType() == 2) {
|
||||||
|
point.setPoints(point.getPoints() + extraPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
rs.executeUpdate("update uf_yezwjfk set rznx = ?,jftj = ? where id = ?",point.getJobYears(),point.getPoints(),point.getId());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package weaver.interfaces.wysecond;
|
||||||
|
|
||||||
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author liang.cheng
|
||||||
|
* @Date 2025/4/1 18:04
|
||||||
|
* @Description: 人员信息存为快照 业务字段全部转换成文本存储 (分部 部门 人员id除外)
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public class ResourceInfoSnipCron extends BaseCronJob {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue