feat: 时间正则匹配通过 获取打职位变更时间
时间正则匹配通过 获取打职位变更时间
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.aos.fileidentify.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -65,4 +66,9 @@ public class Post {
|
||||
* Post type
|
||||
*/
|
||||
private String postType;
|
||||
/**
|
||||
* 是否为兼任
|
||||
*/
|
||||
private Boolean isPart;
|
||||
|
||||
}
|
||||
|
||||
@@ -28,10 +28,12 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javafx.geometry.Pos;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -54,9 +56,8 @@ public class FileIdentifyServiceImpl implements FileIdentifyService {
|
||||
* Employee mapper
|
||||
*/
|
||||
private final EmployeeMapper employeeMapper;
|
||||
|
||||
/** Employee change mapper */
|
||||
private final EmployeeChangeMapper employeeChangeMapper;
|
||||
|
||||
/**
|
||||
* Post mapper
|
||||
*/
|
||||
@@ -154,16 +155,21 @@ public class FileIdentifyServiceImpl implements FileIdentifyService {
|
||||
Employee employee = this.employeeMapper.selectOne(new QueryWrapper<Employee>().lambda().eq(Employee::getName,
|
||||
pdfFileDTO.getName()));
|
||||
Assert.notNull(employee, "这个员工不存在");
|
||||
Post post = this.postMapper.selectOne(new QueryWrapper<Post>().lambda().eq(Post::getEmployeeKey, employee.getEmployeeKey()));
|
||||
Assert.notNull(post, "职务信息不存在");
|
||||
post.setCurrentPosition(pdfFileDTO.getCurrentPosition());
|
||||
EmployeeChange employeeChange = EmployeeChange.builder()
|
||||
.employee_key(employee.getEmployeeKey())
|
||||
.original_position(post.getCurrentPosition())
|
||||
.change_position(pdfFileDTO.getPreviousPosition())
|
||||
.change_time(pdfFileDTO.getChangeTime())
|
||||
.build();
|
||||
this.employeeChangeMapper.insert(employeeChange);
|
||||
List<Post> postList = this.postMapper.selectList(new QueryWrapper<Post>().lambda().eq(Post::getEmployeeKey,
|
||||
employee.getEmployeeKey()));
|
||||
//获取倒现任职位
|
||||
Post post =
|
||||
postList.stream().filter(p -> p.getCurrentPosition().equals(pdfFileDTO.getPreviousPosition())).findAny().orElse(null);
|
||||
if (Objects.nonNull(post)) {
|
||||
post.setCurrentPosition(pdfFileDTO.getCurrentPosition());
|
||||
EmployeeChange employeeChange = EmployeeChange.builder()
|
||||
.employee_key(employee.getEmployeeKey())
|
||||
.original_position(post.getCurrentPosition())
|
||||
.change_position(pdfFileDTO.getPreviousPosition())
|
||||
.change_time(pdfFileDTO.getChangeTime())
|
||||
.build();
|
||||
this.employeeChangeMapper.insert(employeeChange);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,17 +199,18 @@ public class FileIdentifyServiceImpl implements FileIdentifyService {
|
||||
private void saveEmployeeApproval(List<EmployeeApprovalDTO> dataList) {
|
||||
List<String> employeeKeyList =
|
||||
employeeMapper.selectList(new QueryWrapper<>()).stream().map(Employee::getEmployeeKey).collect(Collectors.toList());
|
||||
for (EmployeeApprovalDTO employeeApprovalDTO : dataList) {
|
||||
dataList.forEach(employeeApprovalDTO -> {
|
||||
String employKey = CodeUtils.getEmployeeKey(employeeApprovalDTO.getName(), employeeApprovalDTO.getBirth().toString());
|
||||
boolean flag = Objects.nonNull(employeeApprovalDTO.getIsConcurrently()) && employeeApprovalDTO.getIsConcurrently().equals("兼");
|
||||
if (employeeKeyList.contains(employKey)) {
|
||||
this.savePost(employeeApprovalDTO, employKey);
|
||||
this.savePost(employeeApprovalDTO, employKey, flag);
|
||||
} else {
|
||||
employeeKeyList.add(employKey);
|
||||
this.saveEmployee(employeeApprovalDTO, employKey);
|
||||
this.savePost(employeeApprovalDTO, employKey);
|
||||
this.savePost(employeeApprovalDTO, employKey, flag);
|
||||
}
|
||||
log.info(employeeApprovalDTO.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,9 +220,10 @@ public class FileIdentifyServiceImpl implements FileIdentifyService {
|
||||
* @param employKey employ key
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private void savePost(EmployeeApprovalDTO employeeApprovalDTO, String employKey) {
|
||||
private void savePost(EmployeeApprovalDTO employeeApprovalDTO, String employKey, Boolean isPart) {
|
||||
Post post = new Post();
|
||||
BeanUtils.copyProperties(employeeApprovalDTO, post);
|
||||
post.setIsPart(isPart);
|
||||
post.setEmployeeKey(employKey);
|
||||
this.postMapper.insert(post);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user