Commit 50798f17 authored by hongguangwu's avatar hongguangwu

人员档案导入-更新,换代码逻辑date

parent d5b0fb68
......@@ -27,8 +27,7 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Set;
......@@ -60,7 +59,7 @@ public class TEmployeeInfo extends BaseEntity {
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@ExcelAttribute(name = "员工类型", isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
@ExcelAttribute(name = "员工类型", isDataId = true, dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型(字典值,0外包1派遣2代理)")
@NotNull(message = "员工类型不可为空")
@Size(max = 1, message = "员工类型不可超过1位")
......@@ -87,14 +86,14 @@ public class TEmployeeInfo extends BaseEntity {
*/
@Schema(description = "身份证有效期起")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate validityStart;
private Date validityStart;
/**
* 身份证有效期止
*/
@Schema(description = "身份证有效期止")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate validityEnd;
private Date validityEnd;
/**
* 性别
......@@ -106,7 +105,7 @@ public class TEmployeeInfo extends BaseEntity {
* 出生日期
*/
@Schema(description = "出生日期")
private LocalDate empBirthday;
private Date empBirthday;
/**
* 年龄
......@@ -227,14 +226,14 @@ public class TEmployeeInfo extends BaseEntity {
*/
@Schema(description = "入学时间")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate admissionDate;
private Date admissionDate;
/**
* 毕业时间
*/
@Schema(description = "毕业时间")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate gradutionDate;
private Date gradutionDate;
/**
* 备注
......@@ -321,7 +320,7 @@ public class TEmployeeInfo extends BaseEntity {
*/
@Schema(description = "离职时间")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDateTime leaveTime;
private Date leaveTime;
/**
* 离职原因
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @Author fxj
......@@ -133,7 +134,7 @@ public class TCertRecordVo implements Serializable {
*/
@ExcelAttribute(name = "离职时间" )
@Schema(description ="离职时间")
private LocalDateTime leaveTime;
private Date leaveTime;
/**
* 派减原因
......
......@@ -304,7 +304,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
if (null != date) {
//初始化年龄
newEmployeeInfo.setEmpAge(IdCardUtil.IdNOToAge(fddContractAttachInfo.getEmpIdcard()));
newEmployeeInfo.setEmpBirthday(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
newEmployeeInfo.setEmpBirthday(date);
}
newEmployeeInfo.setEmpSex(IdCardUtil.getSex(fddContractAttachInfo.getEmpIdcard()));
tEmployeeInfoMapper.insert(newEmployeeInfo);
......
......@@ -64,9 +64,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
......@@ -431,7 +429,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
employee.setFileStatus(CommonConstants.ONE_INT);
employee.setLeaveUser(user.getId());
employee.setLeaveUserName(user.getNickname());
employee.setLeaveTime(LocalDateTime.now());
employee.setLeaveTime(new Date());
employee.setLeaveReason(excel.getLeaveReason());
employee.setLeaveRemark(excel.getLeaveRemark());
canDeleteList.add(employee);
......@@ -485,7 +483,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
employee.setFileStatus(CommonConstants.ONE_INT);
employee.setLeaveUser(user.getId());
employee.setLeaveUserName(user.getNickname());
employee.setLeaveTime(LocalDateTime.now());
employee.setLeaveTime(new Date());
employee.setLeaveReason(leaveReason);
employee.setLeaveRemark(leaveRemark);
this.updateById(employee);
......@@ -591,12 +589,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
**/
private void setBaseSexInfo(TEmployeeInfo employeeInfo) {
String idCard = employeeInfo.getEmpIdcard();
if (Common.isNotNull(idCard) && Common.isEmpty(employeeInfo.getEmpSex())) {
if (Common.isNotNull(idCard) && Common.isEmpty(employeeInfo.getEmpSex()) && idCard.length() > 14) {
// 出生日期
String idCardDate = idCard.substring(6, 14);
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDate empBirthday = LocalDate.parse(idCardDate, fmt);
Date empBirthday = DateUtil.stringToDateByPatten(idCardDate, "yyyyMMdd");
employeeInfo.setEmpBirthday(empBirthday);
// 性别
......@@ -1776,8 +1773,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
education.setHighIdentification(CommonConstants.ZERO_STRING);
education.setSchool(employeeInfo.getSchool());
education.setMajor(employeeInfo.getMajor());
education.setEntryDate(LocalDateTimeUtils.convertLDToDate(employeeInfo.getAdmissionDate()));
education.setGradutionDate(LocalDateTimeUtils.convertLDToDate(employeeInfo.getGradutionDate()));
education.setEntryDate(employeeInfo.getAdmissionDate());
education.setGradutionDate(employeeInfo.getGradutionDate());
tEmpEducationService.insertEducationOfEmp(education);
}
}
......
......@@ -342,6 +342,18 @@ public class DateUtil {
public static Date stringToDate(String dateString) {
return stringToDate2(dateString, ISO_EXPANDED_DATE_FORMAT);
}
/**
* @param dateString
* @param patten 格式
* @Description:
* @Author: hgw
* @Date: 2022/7/8 12:02
* @return: java.util.Date
**/
public static Date stringToDateByPatten(String dateString, String patten) {
return stringToDate2(dateString, patten);
}
/**
* @param pattern
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment