数据导入--报错信息格式调整

This commit is contained in:
zhn
2022-05-19 11:48:01 +08:00
parent bc7ad16551
commit b601ff66e6
3 changed files with 86 additions and 81 deletions
@@ -4382,18 +4382,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "不能超过" + dbLength + "个字符";
errorMsg += key + "不能超过" + dbLength + "个字符, ";
}else{
errorMsg += key + " Can not be more than " + dbLength + " char";
errorMsg += key + " Can not be more than " + dbLength + " char, ";
}
countError++;
}
@@ -4402,9 +4402,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
for (String valueTemp : value.split(",")) {
if (!treeNameList.contains(valueTemp)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "中的" + valueTemp + "与数据字典不匹配";
errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, ";
}else{
errorMsg += key +" "+ valueTemp + " Does not match the data dictionary";
errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, ";
}
countError++;
}
@@ -4427,18 +4427,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "不能超过" + dbLength + "个字符";
errorMsg += key + "不能超过" + dbLength + "个字符, ";
}else{
errorMsg += key + " Can not be more than" + dbLength + "char";
errorMsg += key + " Can not be more than" + dbLength + "char, ";
}
countError++;
}
@@ -4452,27 +4452,27 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "不能超过" + dbLength + "个字符";
errorMsg += key + "不能超过" + dbLength + "个字符, ";
}else{
errorMsg += key + " Can not be more than" + dbLength + " char";
errorMsg += key + " Can not be more than" + dbLength + " char, ";
}
countError++;
}
//判断是否是单选
if (StringUtils.isNotBlank(value) && value.contains(",")) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为单选项";
errorMsg += key + "为单选项, ";
}else{
errorMsg += key + " Is multiple Choice";
errorMsg += key + " Is multiple choice, ";
}
countError++;
@@ -4481,9 +4481,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (StringUtils.isNotBlank(value)) {
if (!itemNameList.contains(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "中的" + value + "与数据字典不匹配";
errorMsg += key + "中的" + value + "与数据字典不匹配, ";
}else{
errorMsg += key + " " + value + " Does not match the data dictionary";
errorMsg += key + " " + value + " Does not match the data dictionary, ";
}
countError++;
}
@@ -4500,18 +4500,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "不能超过" + dbLength + "个字符";
errorMsg += key + "不能超过" + dbLength + "个字符, ";
}else{
errorMsg += key + " Can not be more than" + dbLength + " char";
errorMsg += key + " Can not be more than" + dbLength + " char, ";
}
countError++;
}
@@ -4520,9 +4520,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
for (String valueTemp : value.split(",")) {
if (!itemNameList.contains(valueTemp)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "中的" + valueTemp + "与数据字典不匹配";
errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, ";
}else{
errorMsg += key +" "+ valueTemp + " Does not match the data dictionary";
errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, ";
}
countError++;
}
@@ -4550,27 +4550,27 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//a判断是否是单日期选择
if (StringUtils.isNotBlank(value) && value.contains(",")) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为单日期选项";
errorMsg += key + "为单日期选项, ";
}else{
errorMsg += key + " Is single date option";
errorMsg += key + " Is single date option, ";
}
countError++;
}
//判断格式是否正确
if (!DateUtils.isValidDate((String) value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "格式不正确,正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, ";
}else{
errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, ";
}
countError++;
}
@@ -4580,18 +4580,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断格式是否正确
if (!DateUtils.isValidDate((String) value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "格式不正确,正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, ";
}else{
errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, ";
}
countError++;
}
@@ -4602,18 +4602,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "不能超过" + dbLength + "个字符";
errorMsg += key + "不能超过" + dbLength + "个字符, ";
}else{
errorMsg += key + " Can not be more than " + dbLength + " char";
errorMsg += key + " Can not be more than " + dbLength + " char, ";
}
countError++;
}
@@ -4623,9 +4623,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,cut,errorMsg,null,key,key);
if (nowFileList.size() == 0) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "压缩包中没有" + fileName + "文件; ";
errorMsg += key + "压缩包中没有" + fileName + "文件, ";
}else{
errorMsg += key + " Not in the zip package" + fileName + "file; ";
errorMsg += key + " Not in the zip package" + fileName + "file, ";
}
countError++;
} else {
@@ -4654,18 +4654,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//判断是否必填
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "为必填项,不能为空";
errorMsg += key + "为必填项,不能为空, ";
}else{
errorMsg += key + " This parameter is mandatory and cannot be empty";
errorMsg += key + " This parameter is mandatory and cannot be empty, ";
}
countError++;
}
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)){
errorMsg += key + "不能超过" + dbLength + "个字符";
errorMsg += key + "不能超过" + dbLength + "个字符, ";
}else{
errorMsg += key + " Can not be more than " + dbLength + " char";
errorMsg += key + " Can not be more than " + dbLength + " char, ";
}
countError++;
}
@@ -4702,7 +4702,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
mapResult.put(field, value);
}
if (countError > 0) {
msgList.add(errorMsg);
if(errorMsg.endsWith(", ")){
String substring = errorMsg.substring(0, errorMsg.length() - 2);
msgList.add(substring);
}else{
msgList.add(errorMsg);
}
}
mapList.add(mapResult);
}
@@ -1033,9 +1033,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
if(subtitle.length() > 100){
String message = "";
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEOTemp.getCut())){
message = errorMsg + "子标题不能超过100个字符";
message = errorMsg + "子标题不能超过100个字符, ";
}else{
message = errorMsg + " Subheadings cannot be checked more than 100 characters";
message = errorMsg + " Subheadings cannot be checked more than 100 characters, ";
}
msgList.add(message);
}
@@ -1045,9 +1045,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
if(wvtaId.length() > 100){
String message = "";
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEOTemp.getCut())){
message = errorMsg + "WVTA ID不能超过100个字符";
message = errorMsg + "WVTA ID不能超过100个字符, ";
}else{
message = errorMsg + " The WVTA ID cannot contain more than 100 characters";
message = errorMsg + " The WVTA ID cannot contain more than 100 characters, ";
}
msgList.add(message);
}
@@ -1057,9 +1057,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
if(remark.length() > 300){
String message = "";
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEOTemp.getCut())){
message = errorMsg + "备注不能超过300个字符";
message = errorMsg + "备注不能超过300个字符, ";
}else{
message = errorMsg + " Note The value cannot exceed 300 characters";
message = errorMsg + " Note The value cannot exceed 300 characters, ";
}
msgList.add(message);
}
@@ -1317,18 +1317,18 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
if(StringUtils.isNotBlank(technologyTerritory)){
if(technologyTerritory.contains(",")){
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
errorMsg += "技术领域" + " 为单选项";
errorMsg += "技术领域" + " 为单选项, ";
}else{
errorMsg += " technical field" + " is multiple Choice";
errorMsg += " technical field" + " is multiple choice, ";
}
msgList.add(errorMsg);
}else{
List<SysCategory> collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getName())).collect(Collectors.toList());
if(collect.size() == 0){
if (CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())) {
errorMsg += "技术领域中的" + technologyTerritory + "与数据字典不匹配";
errorMsg += "技术领域中的" + technologyTerritory + "与数据字典不匹配, ";
} else {
errorMsg += " In the field of technology " + technologyTerritory + " does not match the data dictionary";
errorMsg += " In the field of technology " + technologyTerritory + " does not match the data dictionary, ";
}
msgList.add(errorMsg);
}else{
@@ -1344,18 +1344,18 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
if(StringUtils.isNotBlank(value)){
if(value.contains(",")){
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
errorMsg += nameCn + " 为单选项";
errorMsg += nameCn + " 为单选项, ";
}else{
errorMsg += nameEn + " Is multiple Choice";
errorMsg += nameEn + " Is multiple Choice, ";
}
msgList.add(errorMsg);
}else{
List<SysDictItem> collect = dictItemList.stream().filter(e ->dictCode.equals(e.getDictCode()) && value.equals(e.getItemText())).collect(Collectors.toList());
if (collect.size() == 0) {
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
errorMsg += nameCn + "中的" + value + "与数据字典不匹配";
errorMsg += nameCn + "中的" + value + "与数据字典不匹配, ";
}else{
errorMsg += nameEn +" "+ value + " does not match the data dictionary";
errorMsg += nameEn +" "+ value + " does not match the data dictionary, ";
}
msgList.add(errorMsg);
}else{
@@ -1379,9 +1379,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
List<String> finalValueList = valueList;
List<String> diffList = list.stream().filter(e -> !finalValueList.contains(e)).collect(Collectors.toList());
if (CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())) {
errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配";
errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配, ";
} else {
errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary";
errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary, ";
}
msgList.add(errorMsg);
}
@@ -1395,9 +1395,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
if(StringUtils.isBlank(serialNumber)){
errorCount ++;
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
errorMsg += nameCn + "为必填项,不能为空";
errorMsg += nameCn + "为必填项,不能为空, ";
}else{
errorMsg += nameEn + " this parameter is mandatory and cannot be empty";
errorMsg += nameEn + " this parameter is mandatory and cannot be empty, ";
}
msgList.add(errorMsg);
}
@@ -2492,9 +2492,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(subtitle.length() > 100){
String message = "";
if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){
message = errorMsg + "子标题不能超过100个字符";
message = errorMsg + "子标题不能超过100个字符, ";
}else{
message = errorMsg + " Subheadings cannot be checked more than 100 characters";
message = errorMsg + " Subheadings cannot be checked more than 100 characters, ";
}
msgList.add(message);
}
@@ -2504,9 +2504,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(wvtaId.length() > 100){
String message = "";
if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){
message = errorMsg + "WVTA ID不能超过100个字符";
message = errorMsg + "WVTA ID不能超过100个字符, ";
}else{
message = errorMsg + " The WVTA ID cannot contain more than 100 characters";
message = errorMsg + " The WVTA ID cannot contain more than 100 characters, ";
}
msgList.add(message);
}
@@ -2516,9 +2516,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(remark.length() > 300){
String message = "";
if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){
message = errorMsg + "备注不能超过300个字符";
message = errorMsg + "备注不能超过300个字符, ";
}else{
message = errorMsg + " Note The value cannot exceed 300 characters";
message = errorMsg + " Note The value cannot exceed 300 characters, ";
}
msgList.add(message);
}
@@ -2651,7 +2651,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//责任人
if(StringUtils.isNotBlank(prehomoDuty)){
nameCn = "Pre-homo确认责任人";
nameEn = "Pre-homo identifies the person responsible";
nameEn = "Pre-homo identifies the person responsible ";
//验证人员是否存在
personnelVerify(projectLawsInventoryEO, errorMsg, msgList,prehomoDuty, allPersonList,nameCn,nameEn,ProjectRoleEnum.PREHOMODUTY.getValue());
}
@@ -2784,9 +2784,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//单选
if(regulationOwnerId.contains(",")){
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
errorMsg += nameCn + "导入只能填写一个用户名";
errorMsg += nameCn + "导入只能填写一个用户名, ";
}else{
errorMsg += "Only one user name can be entered for"+ nameEn +"import";
errorMsg += "Only one user name can be entered for"+ nameEn +"import, ";
}
msgList.add(errorMsg);
}
@@ -2848,7 +2848,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if (!DateUtils.isValidDate(format)) {
flag = false;
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
errorMsg += nameCn + "格式不正确,正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
errorMsg += nameCn + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
}else{
errorMsg += nameEn + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日";
}
@@ -2864,9 +2864,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(StringUtils.isBlank(serialNumber)){
errorCount ++;
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
errorMsg += nameCn + "为必填项,不能为空";
errorMsg += nameCn + "为必填项,不能为空, ";
}else{
errorMsg += nameEn + "this parameter is mandatory and cannot be empty";
errorMsg += nameEn + "This parameter is mandatory and cannot be empty, ";
}
msgList.add(errorMsg);
}
@@ -2891,9 +2891,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
List<String> finalValueList = valueList;
List<String> diffList = list.stream().filter(e -> !finalValueList.contains(e)).collect(Collectors.toList());
if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) {
errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配";
errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配, ";
} else {
errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary";
errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary, ";
}
msgList.add(errorMsg);
}
@@ -2907,18 +2907,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(StringUtils.isNotBlank(value)){
if(value.contains(",")){
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
errorMsg += nameCn + " 为单选项";
errorMsg += nameCn + " 为单选项, ";
}else{
errorMsg += nameEn + " Is multiple Choice";
errorMsg += nameEn + " Is multiple choice, ";
}
msgList.add(errorMsg);
}else{
List<SysDictItem> collect = dictItemList.stream().filter(e ->dictCode.equals(e.getDictCode()) && value.equals(e.getItemText())).collect(Collectors.toList());
if (collect.size() == 0) {
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
errorMsg += nameCn + "中的" + value + "与数据字典不匹配";
errorMsg += nameCn + "中的" + value + "与数据字典不匹配, ";
}else{
errorMsg += nameEn +" "+ value + " does not match the data dictionary";
errorMsg += nameEn +" "+ value + " does not match the data dictionary, ";
}
msgList.add(errorMsg);
}else{