Commit 343a724e authored by huyuchen's avatar huyuchen

hyc-身份证截止日期调整

parent 8a745de2
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
/**
* 项目档案表excel对应的实体
*
* @author huyc
* @date 2022-06-20 17:54:40
*/
@Data
@ColumnWidth(30)
public class EmployeeInsertVO extends RowIndex implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "员工类型")
private String empNatrue;
/**
* 员工姓名
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "员工姓名")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, maxLength = 20, needExport = true, errorInfo = "员工姓名必填且不可超过20位")
@Size(max = 20, message = "员工姓名不可超过20位")
private String empName;
/**
* 身份证号
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "身份证号")
@ExcelAttribute(name = "身份证号", isNotEmpty = true, maxLength = 20, needExport = true, errorInfo = "身份证号必填且不可超过20位")
@Size(max = 20, message = "身份证号不可超过20位")
private String empIdcard;
/**
* 项目编码
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "项目编码")
@ExcelAttribute(name = "项目编码", maxLength = 32, needExport = true, errorInfo = "项目编码必填且不可超过20位")
@Size(max = 32, message = "项目编码不可超过32位")
private String deptNo;
/**
* 就职岗位
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "就职岗位")
@Size(max = 50, message = "就职岗位不可超过50位")
private String post;
/**
* 身份证有效期起
*/
@DateTimeFormat("yyyy-MM-dd")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "身份证开始日期")
private Date validityStart;
/**
* 身份证有效期止
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "身份证截止日期")
@ExcelAttribute(name = "身份证截止日期", maxLength = 32, errorInfo = "身份证截止日期不可超过10位")
private String validityEnd;
/**
* 婚姻状况
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "婚姻状况")
@Size(max = 32, message = "婚姻状况不可超过32位")
private String empMarriStatus;
/**
* 民族
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "民族")
@Size(max = 32, message = "民族不可超过32位")
private String empNational;
/**
* 政治面貌
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "政治面貌")
@Size(max = 32, message = "政治面貌不可超过32位")
private String politicalStatus;
/**
* 手机号码
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "手机号码")
@Size(max = 11, message = "手机号码不可超过11位")
private String empPhone;
/**
* 邮箱
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "邮箱")
@Size(max = 32, message = "邮箱不可超过32位")
private String empEmail;
/**
* 身份证-省
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户籍所在省")
private String idProvince;
/**
* 身份证-市
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户籍所在市")
private String idCity;
/**
* 身份证-县
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户籍所在县")
private String idTown;
/**
* 户口性质
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户口性质")
private String empRegisType;
/**
* 档案-省
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "档案所在省")
private String fileProvince;
/**
* 档案-市
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "档案所在市")
private String fileCity;
/**
* 档案-县
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "档案所在县")
private String fileTown;
/**
* 是否大专及以上(0否1是)
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "是否大专及以上")
private String isCollege;
/**
* 最高学历(字典值)
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "最高学历")
private String hignEducation;
/**
* 学校
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "学校")
private String school;
/**
* 专业
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "专业")
private String major;
/**
* 入学时间
*/
@DateTimeFormat("yyyy-MM-dd")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "入学时间")
private Date admissionDate;
/**
* 毕业时间
*/
@DateTimeFormat("yyyy-MM-dd")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "毕业时间")
private Date gradutionDate;
/**
* 备注
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "备注")
private String remark;
/**
* 通信地址
*/
@Schema(description = "通信地址")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "通信地址")
private String contactAddress;
}
......@@ -11,6 +11,7 @@ public class EmployeeConstants {
public static final String DEPT_NO_LENGTH = "项目编码长度超过20";
public static final String VALIDITY_START = "身份证开始日期必填";
public static final String VALIDITY_END = "身份证截止日期必填";
public static final String VALIDITY_END_FORMAT = "身份证截止日期只能为日期格式或者固定值:长期";
public static final String EMP_NATIONAL = "民族必填";
public static final String ID_PROVINCE = "户籍所在地必填";
public static final String FILE_PROVINCE = "档案所在地必填";
......
......@@ -779,7 +779,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return null;
}
private void checkEmployeeVOR(long lineNum, EmployeeVO employeeInfo, Map<Long, ErrorMessage> errorMsgMap, Set<String> errorMsg) {
private void checkEmployeeVOR(long lineNum, EmployeeInsertVO employeeInfo, Map<Long, ErrorMessage> errorMsgMap, Set<String> errorMsg) {
if (Common.isEmpty(employeeInfo.getEmpIdcard())) {
errorMsg.add("身份证号必填");
errorMsgMap.put(lineNum, new ErrorMessage("身份证号必填"));
......@@ -875,18 +875,24 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg.add("就职岗位必填!");
errorMsgMap.put(lineNum, new ErrorMessage("就职岗位必填!"));
}
//MVP1.6.7-huyc-身份证期限截止日期调整-校验日期
if (Common.isNotNull(employeeInfo.getValidityEnd()) && !"长期".equals(employeeInfo.getValidityEnd()) &&
!DateUtil.checkStringToDate(employeeInfo.getValidityEnd(),DateUtil.ISO_EXPANDED_DATE_FORMAT)) {
errorMsg.add(EmployeeConstants.VALIDITY_END_FORMAT);
errorMsgMap.put(lineNum, new ErrorMessage(EmployeeConstants.VALIDITY_END));
}
}
@Override
public R<List<ErrorMessage>> batchImportEmployee(InputStream inputStream, int isCanAdd) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeVO> util1 = new ExcelUtil<>(EmployeeVO.class);
ExcelUtil<EmployeeInsertVO> util1 = new ExcelUtil<>(EmployeeInsertVO.class);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmployeeVO.class, new ReadListener<EmployeeVO>() {
EasyExcel.read(inputStream, EmployeeInsertVO.class, new ReadListener<EmployeeInsertVO>() {
/**
* 单次缓存的数据量
*/
......@@ -894,10 +900,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
/**
*临时存储
*/
private List<EmployeeVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private List<EmployeeInsertVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmployeeVO data, AnalysisContext context) {
public void invoke(EmployeeInsertVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
......@@ -944,7 +950,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
private R<List<ErrorMessage>> batchImportCore(List<EmployeeVO> excelVOList, int isCanAdd, List<ErrorMessage> errorMessageList) {
private R<List<ErrorMessage>> batchImportCore(List<EmployeeInsertVO> excelVOList, int isCanAdd, List<ErrorMessage> errorMessageList) {
if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -1034,7 +1040,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
EmployeeVO excel;
EmployeeInsertVO excel;
// 已存在的档案信息
TEmployeeInfo existEmp;
// 需要保存的档案信息
......@@ -1292,7 +1298,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
saveEmp.setValidityStart(excel.getValidityStart());
saveEmp.setValidityEnd(excel.getValidityEnd());
if ("长期".equals(excel.getValidityEnd())) {
saveEmp.setValidityEnd(DateUtil.stringToDate("2999-12-31", DateUtil.ISO_EXPANDED_DATE_FORMAT));
} else {
saveEmp.setValidityEnd(DateUtil.stringToDate(excel.getValidityEnd(), DateUtil.ISO_EXPANDED_DATE_FORMAT));
}
// 邮箱
if (Common.isNotNull(excel.getEmpEmail())) {
if (excel.getEmpEmail().contains("@")) {
......@@ -1481,13 +1491,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public R<List<ErrorMessage>> batchUpdateEmployee(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeVO> util1 = new ExcelUtil<>(EmployeeVO.class);
ExcelUtil<EmployeeInsertVO> util1 = new ExcelUtil<>(EmployeeInsertVO.class);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmployeeVO.class, new ReadListener<EmployeeVO>() {
EasyExcel.read(inputStream, EmployeeInsertVO.class, new ReadListener<EmployeeInsertVO>() {
/**
* 单次缓存的数据量
*/
......@@ -1495,10 +1505,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
/**
*临时存储
*/
private List<EmployeeVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private List<EmployeeInsertVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmployeeVO data, AnalysisContext context) {
public void invoke(EmployeeInsertVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
......@@ -1544,7 +1554,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
private R<List<ErrorMessage>> batchUpdateCore(List<EmployeeVO> excelVOList, List<ErrorMessage> errorMessageList) {
private R<List<ErrorMessage>> batchUpdateCore(List<EmployeeInsertVO> excelVOList, List<ErrorMessage> errorMessageList) {
YifuUser user = SecurityUtils.getUser();
Set<String> errorMsg;
if (user == null || Common.isEmpty(user.getId())) {
......@@ -1601,7 +1611,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 个性化校验逻辑
EmployeeVO excel;
EmployeeInsertVO excel;
// 需要保存的档案信息
TEmployeeInfo saveEmp;
// 原先的档案信息
......@@ -1809,7 +1819,17 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp.setValidityStart(excel.getValidityStart());
}
if (Common.isNotNull(excel.getValidityEnd())) {
saveEmp.setValidityEnd(excel.getValidityEnd());
//MVP1.6.7-huyc-身份证期限截止日期调整-校验日期
if (!"长期".equals(excel.getValidityEnd()) && !DateUtil.checkStringToDate(
excel.getValidityEnd(),DateUtil.ISO_EXPANDED_DATE_FORMAT)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_END, excel.getEmpIdcard()));
} else {
if ("长期".equals(excel.getValidityEnd())) {
saveEmp.setValidityEnd(DateUtil.stringToDate("2999-12-31", DateUtil.ISO_EXPANDED_DATE_FORMAT));
} else {
saveEmp.setValidityEnd(DateUtil.stringToDate(excel.getValidityEnd(), DateUtil.ISO_EXPANDED_DATE_FORMAT));
}
}
}
// 邮箱
if (Common.isNotNull(excel.getEmpEmail())) {
......
......@@ -268,6 +268,7 @@ public interface ErrorCodes {
String ARCHIVES_IMPORT_EMP_HAVE_PROJECT = "archives.import.emp.have.project";
String ARCHIVES_IMPORT_EMP_EMAIL_CHECK = "archives.import.emp.email.check";
String ARCHIVES_IMPORT_EMP_EMAIL_LENGTH = "archives.import.emp.email.length";
String ARCHIVES_IMPORT_EMP_IDCARD_END = "archives.import.emp.idcard.end";
// 减项原因在字典中未找到
String ARCHIVES_IMPORT_EMP_REDUCE_ERROR = "archives.import.emp.reduce.error";
/**
......
......@@ -90,6 +90,7 @@ archives.import.emp.leaveRemark.length=\u51CF\u6863\u5907\u6CE8\u8D85\u8FC7200
archives.import.emp.have.project=\u7981\u6B62\u201C\u51CF\u6863\u201D \u8BE5\u4EBA\u5458\u5B58\u5728\u201C\u6B63\u5E38\u201D\u5B58\u7EED\u7684\u201C\u9879\u76EE\u6863\u6848\u201D
archives.import.emp.email.check=\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1\u683C\u5F0F
archives.import.emp.email.length=\u90AE\u7BB1\u4E0D\u53EF\u8D85\u8FC750\u5B57
archives.import.emp.idcard.end=\u8EAB\u4EFD\u8BC1\u622A\u6B62\u65E5\u671F\u53EA\u80FD\u4E3A\u65E5\u671F\u683C\u5F0F\u6216\u8005\u56FA\u5B9A\u503C:\u957F\u671F
import.file.type.error=\u5BFC\u5165\u7684\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E
......
......@@ -509,7 +509,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
List<String> list2 = list.stream().map(PersonVo::getUid).collect(Collectors.toList());
List<String> collect = list1.stream().filter(s -> !list2.contains(s)
).collect(Collectors.toList());
log.info("要重置为不可用的用户列表:" + collect);
log.error("要重置为不可用的用户列表:" + collect);
if (!collect.isEmpty()) {
LambdaUpdateWrapper<SysUser> settleUpdate = new LambdaUpdateWrapper<>();
settleUpdate.in(SysUser::getUsername, collect)
......
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