feat: 时间正则匹配通过 获取打职位变更时间

时间正则匹配通过 获取打职位变更时间
This commit is contained in:
yangjiyu
2022-07-12 18:20:38 +08:00
parent 44aa41f1de
commit 2e3a8c17bd
@@ -66,13 +66,11 @@ public class FileIdentifyServiceImpl implements FileIdentifyService {
Assert.notNull(file, "上传数据为空");
try {
String pdfContent = PdfUtils.getPdfContent(file);
String pattern = "[〇一二三四五六七八九十]{4}年[〇一二三四五六七八九十]{1,3}月[〇一二三四五六七八九十]{1,3}日";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(pdfContent);
boolean aa = m.matches();
String pattern = "....年[\\u4E00-\\u9FA5]+月[\\u4E00-\\u9FA5]+日";
Matcher m = Pattern.compile(pattern).matcher(pdfContent);
if (m.find()) {
String changTime = m.group(0);
}
String title = pdfContent.replaceAll("任命通知.*", "") + "任命通知";
String mainBody = pdfContent.replaceAll(".*现公布如下:", "").replaceAll("特此通知.*", "");
List<String> tempList = Arrays.stream(mainBody.split("")).collect(Collectors.toList());
@@ -109,7 +107,7 @@ public class FileIdentifyServiceImpl implements FileIdentifyService {
private void updateEmployee(List<PdfFileDTO> pdfFileDTOList) {
pdfFileDTOList.forEach(pdfFileDTO -> {
Employee employee =
this.employeeMapper.selectOne(new QueryWrapper<Employee>().lambda().eq(Employee::getName, pdfFileDTO.getName()));
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, "职务信息不存在");
@@ -144,7 +142,7 @@ 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());
employeeMapper.selectList(new QueryWrapper<>()).stream().map(Employee::getEmployeeKey).collect(Collectors.toList());
for (EmployeeApprovalDTO employeeApprovalDTO : dataList) {
String employKey = CodeUtils.getEmployeeKey(employeeApprovalDTO.getName(), employeeApprovalDTO.getBirth().toString());
if (employeeKeyList.contains(employKey)) {