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