文档库--导入修改

This commit is contained in:
zhn
2022-03-09 19:02:03 +08:00
parent b7129e4def
commit 643cd72daa
2 changed files with 38 additions and 9 deletions
@@ -654,15 +654,17 @@ public class DateUtils extends PropertyEditorSupport {
* @Return: boolean * @Return: boolean
*/ */
public static boolean isValidDate(String str){ public static boolean isValidDate(String str){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); if(org.apache.commons.lang3.StringUtils.isNotBlank(str)){
String[] strArr = str.split(","); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
for (String dateStr : strArr) { String[] strArr = str.split(",");
String replace = dateStr.replace("/", "-"); for (String dateStr : strArr) {
try { String replace = dateStr.replace("/", "-");
simpleDateFormat.setLenient(false); try {
simpleDateFormat.parse(replace); simpleDateFormat.setLenient(false);
} catch (Exception e){ simpleDateFormat.parse(replace);
return false; } catch (Exception e){
return false;
}
} }
} }
return true; return true;
@@ -2402,6 +2402,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (StringUtils.isNotBlank(stringCellValue)) { if (StringUtils.isNotBlank(stringCellValue)) {
String replace = stringCellValue.replace("", ","); String replace = stringCellValue.replace("", ",");
rowList.put(headerCell.getStringCellValue(), replace); rowList.put(headerCell.getStringCellValue(), replace);
}else{
rowList.put(headerCell.getStringCellValue(), "");
} }
} }
} }
@@ -2486,6 +2488,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
errorMsg += key + "为必填项,不能为空"; errorMsg += key + "为必填项,不能为空";
countError++; countError++;
} }
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
errorMsg += key + "不能超过" + dbLength + "个字符";
countError++;
}
//判断数据是否匹配 //判断数据是否匹配
if (StringUtils.isNotBlank(value)) { if (StringUtils.isNotBlank(value)) {
for (String valueTemp : value.split(",")) { for (String valueTemp : value.split(",")) {
@@ -2531,6 +2538,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
errorMsg += key + "为必填项,不能为空"; errorMsg += key + "为必填项,不能为空";
countError++; countError++;
} }
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
errorMsg += key + "不能超过" + dbLength + "个字符";
countError++;
}
//判断是否是单选 //判断是否是单选
if (StringUtils.isNotBlank(value) && value.contains(",")) { if (StringUtils.isNotBlank(value) && value.contains(",")) {
errorMsg += key + "为单选项"; errorMsg += key + "为单选项";
@@ -2556,6 +2568,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
errorMsg += key + "为必填项,不能为空"; errorMsg += key + "为必填项,不能为空";
countError++; countError++;
} }
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
errorMsg += key + "不能超过" + dbLength + "个字符";
countError++;
}
//下拉多选 //下拉多选
for (String valueTemp : value.split(",")) { for (String valueTemp : value.split(",")) {
if (!itemNameList.contains(valueTemp)) { if (!itemNameList.contains(valueTemp)) {
@@ -2618,6 +2635,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
errorMsg += key + "为必填项,不能为空"; errorMsg += key + "为必填项,不能为空";
countError++; countError++;
} }
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
errorMsg += key + "不能超过" + dbLength + "个字符";
countError++;
}
if (StringUtils.isNotBlank(value)) { if (StringUtils.isNotBlank(value)) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (String fileName : value.split(",")) { for (String fileName : value.split(",")) {
@@ -2653,6 +2675,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
errorMsg += key + "为必填项,不能为空"; errorMsg += key + "为必填项,不能为空";
countError++; countError++;
} }
//判断长度
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
errorMsg += key + "不能超过" + dbLength + "个字符";
countError++;
}
//判断库中是否存在,如果存在则存id,如果不存在则存输入的值 //判断库中是否存在,如果存在则存id,如果不存在则存输入的值
List<Map<String, Object>> listBySerialNumber = getListBySerialNumber(value); List<Map<String, Object>> listBySerialNumber = getListBySerialNumber(value);
String serialNumberStr = ""; String serialNumberStr = "";