feat: 导入错误提示信息显示字段中文名

This commit is contained in:
2023-09-28 14:21:59 +08:00
parent 0c63b62788
commit 0a6cfbd187
@@ -65,7 +65,8 @@ public class ImportUtil {
// 必填验证
if (YesOrNoEnum.YES.getValue().equals(tag.getFieldMustInput())) {
if (!this.mustInputValid(cell)) {
errMsgList.add("" + (i) + "行第" + (j + 1) + "列为必填");
log.error("" + (i + 1) + "行第" + (j + 1) + "" + tag.getDbFieldTxt() + "为必填");
errMsgList.add("" + (i) + "行第" + (j + 1) + "" + tag.getDbFieldTxt() + "为必填");
return errMsgList;
}
}
@@ -81,8 +82,8 @@ public class ImportUtil {
if (TableNameEnum.ENTERPRISE_STANDARDS.getValue().equals(tag.getIsModel())) {
// 使用正则表达式进行基础的格式验证
if (!cellValue.matches("^[A-Z]{1,2}/[A-Z]{2} [1-9A-HJ-Z]\\d{4}-\\d{4}$")) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列输入的标准编号格式不正确");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列输入的标准编号格式不正确");
log.error("" + (i + 1) + "行第" + (j + 1) + "列输入的" + tag.getDbFieldTxt() + "格式不正确");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列输入的" + tag.getDbFieldTxt() + "格式不正确");
} else {
// 拆分成两部分,前半部分和后半部分
String[] mainParts = cellValue.split(" ");
@@ -120,14 +121,14 @@ public class ImportUtil {
// 字段长度校验
if (FieldShowTypeEnum.TEXT_BOX.getValue().equals(tag.getFieldShowType())) {
if (cellValue.length() > 50) {
log.error("" + (i + 1) + "行第" + (j + 1) + "字段超过50字");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "字段超过50字");
log.error("" + (i + 1) + "行第" + (j + 1) + "输入的" + tag.getDbFieldTxt() + "超过50字");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "输入的" + tag.getDbFieldTxt() + "超过50字");
}
}
if (FieldShowTypeEnum.MULTI_TEXT.getValue().equals(tag.getFieldShowType())) {
if (cellValue.length() > 500) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列字段超过500字");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列字段超过500字");
log.error("" + (i + 1) + "行第" + (j + 1) + "列字段" + tag.getDbFieldTxt() + "超过500字");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列字段" + tag.getDbFieldTxt() + "超过500字");
}
}
@@ -135,8 +136,8 @@ public class ImportUtil {
if (FieldShowTypeEnum.DROPDOWN_SINGLE_SELECT.getValue().equals(tag.getFieldShowType()) ||
FieldShowTypeEnum.DROPDOWN_MULTI_SELECT.getValue().equals(tag.getFieldShowType())) {
if (!this.dictValid(tag.getDictField(), cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为value
cellValue = this.convertDictValue(tag.getDictField(), cellValue);
@@ -145,8 +146,8 @@ public class ImportUtil {
// 单选组织机构
if (FieldShowTypeEnum.SINGLE_ORGANIZATION_DIALOG.getValue().equals(tag.getFieldShowType())) {
if (!this.singleOrgValid(cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertSingleOrgId(cellValue);
@@ -155,8 +156,8 @@ public class ImportUtil {
// 单选人员
if (FieldShowTypeEnum.SINGLE_USER_DIALOG.getValue().equals(tag.getFieldShowType())) {
if (!this.singleUserValid(cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertSingleUserId(cellValue);
@@ -165,8 +166,8 @@ public class ImportUtil {
// 多选组织机构
if (FieldShowTypeEnum.MULTI_ORGANIZATION_DIALOG.getValue().equals(tag.getFieldShowType())) {
if (!this.multiOrgValid(cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertMultiOrgId(cellValue);
@@ -175,8 +176,8 @@ public class ImportUtil {
// 零部件
if (tag.getDbFieldName().equals("part_name") && StrUtil.isNotBlank(cellValue)) {
if (!this.partValid(cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertPartId(cellValue);
@@ -185,8 +186,8 @@ public class ImportUtil {
// 多选组织机构
if (FieldShowTypeEnum.MULTI_ORGANIZATION_DIALOG.getValue().equals(tag.getFieldShowType())) {
if (!this.multiOrgValid(cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertMultiOrgId(cellValue);
@@ -195,8 +196,8 @@ public class ImportUtil {
// 体系
if (FieldCommon.STANDARD_SYSTEM.equals(tag.getDbFieldName())) {
if (!this.standardSystemValid(cellValue)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertStandardSystem(cellValue);
@@ -205,8 +206,8 @@ public class ImportUtil {
// 文件
if (FieldShowTypeEnum.FILE_UPLOAD.getValue().equals(tag.getFieldShowType())) {
if (!this.fileValid(cellValue, fileMap)) {
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "列填写错误");
log.error("" + (i + 1) + "行第" + (j + 1) + "列选项" + tag.getDbFieldTxt() + "填写错误");
errMsgList.add("" + (i + 1) + "行第" + (j + 1) + "选项" + tag.getDbFieldTxt() + "填写错误");
} else {
// 转为id
cellValue = this.convertFileIds(cellValue, fileMap);