Commit eec72767 authored by hongguangwu's avatar hongguangwu

校验长度等优化

parent 8145c9e8
...@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo; ...@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -203,4 +204,10 @@ public class EmployeeVO implements Serializable { ...@@ -203,4 +204,10 @@ public class EmployeeVO implements Serializable {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
/**
* 通信地址
*/
@Schema(description = "通信地址")
private String contactAddress;
} }
package com.yifu.cloud.plus.v1.yifu.archives.Constants;
public class EmployeeConstants {
public static final String IS_OR_NOT = "请填是/否";
public static final String SCHOOL_LENGTH = "学校长度超过50";
public static final String MAJOR_LENGTH = "专业长度超过50";
public static final String CONTACT_ADDRESS_LENGTH = "通信地址长度超过200";
public static final String REMARL_LENGTH = "备注长度超过200";
public static final String POST_LENGTH = "就职岗位长度超过20";
public static final String DEPT_NO_LENGTH = "项目编码长度超过20";
}
...@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard; import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile; import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
...@@ -606,6 +607,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -606,6 +607,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isEmpty(employeeInfo.getDeptNo())) { if (Common.isEmpty(employeeInfo.getDeptNo())) {
errorMsg.add("项目编码必填!"); errorMsg.add("项目编码必填!");
errorMsgMap.put(lineNum, new ErrorMessage("项目编码必填!")); errorMsgMap.put(lineNum, new ErrorMessage("项目编码必填!"));
} else if (employeeInfo.getDeptNo().length() > 20) {
errorMsg.add("项目编码超长!");
errorMsgMap.put(lineNum, new ErrorMessage("项目编码超长!"));
} }
if (Common.isEmpty(employeeInfo.getEmpName())) { if (Common.isEmpty(employeeInfo.getEmpName())) {
errorMsg.add("员工姓名必填!"); errorMsg.add("员工姓名必填!");
...@@ -861,9 +865,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -861,9 +865,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp.setEmpNatrue(empNatrueMap.get(excel.getEmpNatrue())); saveEmp.setEmpNatrue(empNatrueMap.get(excel.getEmpNatrue()));
} }
} }
saveEmp.setValidityStart(excel.getValidityStart());
saveEmp.setValidityEnd(excel.getValidityEnd());
saveEmp.setEmpEmail(excel.getEmpEmail());
// 户籍所在地 // 户籍所在地
if (Common.isNotNull(excel.getIdProvince())) { if (Common.isNotNull(excel.getIdProvince())) {
if (areaMap.get(excel.getIdProvince()) == null) { if (areaMap.get(excel.getIdProvince()) == null) {
...@@ -914,15 +915,54 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -914,15 +915,54 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isEmpty(excel.getHignEducation())) { if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
} }
} else { } else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())){
saveEmp.setIsCollege(CommonConstants.ZERO_INT); saveEmp.setIsCollege(CommonConstants.ZERO_INT);
} else {
errorMsg.add(EmployeeConstants.IS_OR_NOT);
} }
} }
saveEmp.setValidityStart(excel.getValidityStart());
saveEmp.setValidityEnd(excel.getValidityEnd());
// 邮箱
if (Common.isNotNull(excel.getEmpEmail())) {
if (excel.getEmpEmail().contains("@")) {
if (excel.getEmpEmail().length() < 50) {
saveEmp.setEmpEmail(excel.getEmpEmail());
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_EMAIL_LENGTH, excel.getEmpIdcard()));
}
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_EMAIL_CHECK, excel.getEmpIdcard()));
}
}
if (Common.isNotNull(excel.getSchool())) { if (Common.isNotNull(excel.getSchool())) {
saveEmp.setSchool(excel.getSchool()); if (excel.getSchool().length() > 50) {
errorMsg.add(EmployeeConstants.SCHOOL_LENGTH);
} else {
saveEmp.setSchool(excel.getSchool());
}
} }
if (Common.isNotNull(excel.getMajor())) { if (Common.isNotNull(excel.getMajor())) {
saveEmp.setMajor(excel.getMajor()); if (excel.getMajor().length() > 50) {
errorMsg.add(EmployeeConstants.MAJOR_LENGTH);
} else {
saveEmp.setMajor(excel.getMajor());
}
}
if (Common.isNotNull(excel.getContactAddress())) {
if (excel.getContactAddress().length() > 200) {
errorMsg.add(EmployeeConstants.CONTACT_ADDRESS_LENGTH);
} else {
saveEmp.setContactAddress(excel.getContactAddress());
}
}
if (Common.isNotNull(excel.getRemark())) {
if (excel.getRemark().length() > 200) {
errorMsg.add(EmployeeConstants.REMARL_LENGTH);
} else {
saveEmp.setRemark(excel.getRemark());
}
} }
if (Common.isNotNull(excel.getAdmissionDate())) { if (Common.isNotNull(excel.getAdmissionDate())) {
saveEmp.setAdmissionDate(excel.getAdmissionDate()); saveEmp.setAdmissionDate(excel.getAdmissionDate());
...@@ -930,11 +970,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -930,11 +970,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(excel.getGradutionDate())) { if (Common.isNotNull(excel.getGradutionDate())) {
saveEmp.setGradutionDate(excel.getGradutionDate()); saveEmp.setGradutionDate(excel.getGradutionDate());
} }
if (Common.isNotNull(excel.getRemark())) {
saveEmp.setRemark(excel.getRemark());
}
if (Common.isNotNull(excel.getPost())) { if (Common.isNotNull(excel.getPost())) {
saveEmp.setPost(excel.getPost()); if (excel.getPost().length() > 20) {
errorMsg.add(EmployeeConstants.POST_LENGTH);
} else {
saveEmp.setPost(excel.getPost());
}
}
if (Common.isNotNull(excel.getDeptNo())) {
if (excel.getDeptNo().length() > 20) {
errorMsg.add(EmployeeConstants.DEPT_NO_LENGTH);
} else {
saveEmp.setDeptNo(excel.getDeptNo());
}
} }
this.setBaseData(saveEmp, CommonConstants.dingleDigitStrArray[4], user); this.setBaseData(saveEmp, CommonConstants.dingleDigitStrArray[4], user);
saveList.add(saveEmp); saveList.add(saveEmp);
...@@ -1253,9 +1301,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1253,9 +1301,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp.setEmpNatrue(empNatrueMap.get(excel.getEmpNatrue())); saveEmp.setEmpNatrue(empNatrueMap.get(excel.getEmpNatrue()));
} }
} }
saveEmp.setValidityStart(excel.getValidityStart());
saveEmp.setValidityEnd(excel.getValidityEnd());
saveEmp.setEmpEmail(excel.getEmpEmail());
// 户籍所在地 // 户籍所在地
if (Common.isNotNull(excel.getIdProvince())) { if (Common.isNotNull(excel.getIdProvince())) {
if (areaMap.get(excel.getIdProvince()) == null) { if (areaMap.get(excel.getIdProvince()) == null) {
...@@ -1306,15 +1351,55 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1306,15 +1351,55 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isEmpty(excel.getHignEducation())) { if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
} }
} else { } else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())){
saveEmp.setIsCollege(CommonConstants.ZERO_INT); saveEmp.setIsCollege(CommonConstants.ZERO_INT);
} else {
errorMsg.add(EmployeeConstants.IS_OR_NOT);
} }
} }
saveEmp.setValidityStart(excel.getValidityStart());
saveEmp.setValidityEnd(excel.getValidityEnd());
// 邮箱
if (Common.isNotNull(excel.getEmpEmail())) {
if (excel.getEmpEmail().contains("@")) {
if (excel.getEmpEmail().length() < 50) {
saveEmp.setEmpEmail(excel.getEmpEmail());
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_EMAIL_LENGTH, excel.getEmpIdcard()));
}
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_EMAIL_CHECK, excel.getEmpIdcard()));
}
}
if (Common.isNotNull(excel.getSchool())) { if (Common.isNotNull(excel.getSchool())) {
saveEmp.setSchool(excel.getSchool()); if (excel.getSchool().length() > 50) {
errorMsg.add(EmployeeConstants.SCHOOL_LENGTH);
} else {
saveEmp.setSchool(excel.getSchool());
}
} }
if (Common.isNotNull(excel.getMajor())) { if (Common.isNotNull(excel.getMajor())) {
saveEmp.setMajor(excel.getMajor()); if (excel.getMajor().length() > 50) {
errorMsg.add(EmployeeConstants.MAJOR_LENGTH);
} else {
saveEmp.setMajor(excel.getMajor());
}
}
if (Common.isNotNull(excel.getContactAddress())) {
if (excel.getContactAddress().length() > 200) {
errorMsg.add(EmployeeConstants.CONTACT_ADDRESS_LENGTH);
} else {
saveEmp.setContactAddress(excel.getContactAddress());
}
}
if (Common.isNotNull(excel.getRemark())) {
if (excel.getRemark().length() > 200) {
errorMsg.add(EmployeeConstants.REMARL_LENGTH);
} else {
saveEmp.setRemark(excel.getRemark());
}
} }
if (Common.isNotNull(excel.getAdmissionDate())) { if (Common.isNotNull(excel.getAdmissionDate())) {
saveEmp.setAdmissionDate(excel.getAdmissionDate()); saveEmp.setAdmissionDate(excel.getAdmissionDate());
...@@ -1322,8 +1407,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1322,8 +1407,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(excel.getGradutionDate())) { if (Common.isNotNull(excel.getGradutionDate())) {
saveEmp.setGradutionDate(excel.getGradutionDate()); saveEmp.setGradutionDate(excel.getGradutionDate());
} }
if (Common.isNotNull(excel.getRemark())) { if (Common.isNotNull(excel.getPost())) {
saveEmp.setRemark(excel.getRemark()); if (excel.getPost().length() > 20) {
errorMsg.add(EmployeeConstants.POST_LENGTH);
} else {
saveEmp.setPost(excel.getPost());
}
}
if (Common.isNotNull(excel.getDeptNo())) {
if (excel.getDeptNo().length() > 20) {
errorMsg.add(EmployeeConstants.DEPT_NO_LENGTH);
} else {
saveEmp.setDeptNo(excel.getDeptNo());
}
} }
// 更新时,不需要更新其余信息 // 更新时,不需要更新其余信息
newOld = new EmployeeNewOldVO(); newOld = new EmployeeNewOldVO();
......
...@@ -257,6 +257,8 @@ public interface ErrorCodes { ...@@ -257,6 +257,8 @@ public interface ErrorCodes {
String ARCHIVES_IMPORT_EMP_LEAVEREASON_MUST = "archives.import.emp.leaveReason.must"; String ARCHIVES_IMPORT_EMP_LEAVEREASON_MUST = "archives.import.emp.leaveReason.must";
String ARCHIVES_IMPORT_EMP_LEAVEREMARK_LENGTH = "archives.import.emp.leaveRemark.length"; String ARCHIVES_IMPORT_EMP_LEAVEREMARK_LENGTH = "archives.import.emp.leaveRemark.length";
String ARCHIVES_IMPORT_EMP_HAVE_PROJECT = "archives.import.emp.have.project"; 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";
/** /**
* 项目档案状态为已审核,禁止删除 * 项目档案状态为已审核,禁止删除
......
...@@ -84,6 +84,8 @@ archives.import.emp.empName.must=\u5458\u5DE5\u59D3\u540D\u5FC5\u586B ...@@ -84,6 +84,8 @@ archives.import.emp.empName.must=\u5458\u5DE5\u59D3\u540D\u5FC5\u586B
archives.import.emp.leaveReason.must=\u51CF\u6863\u539F\u56E0\u5FC5\u586B archives.import.emp.leaveReason.must=\u51CF\u6863\u539F\u56E0\u5FC5\u586B
archives.import.emp.leaveRemark.length=\u51CF\u6863\u5907\u6CE8\u8D85\u8FC7200 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.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
import.file.type.error=\u5BFC\u5165\u7684\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E import.file.type.error=\u5BFC\u5165\u7684\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E
......
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