dataMap : dataList) {
i++;
int countError = 0; //记录失败数据数量
String errorMsg = "第" + i + "行:
";
@@ -1189,17 +1184,17 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl attrList = new ArrayList<>();
String zrbmOrgNames = "";
- for (Map.Entry entry : dataMap.entrySet()) {
+ for (Map.Entry entry : dataMap.entrySet()) {
String name = entry.getKey();
String value = entry.getValue();
if ("责任部门".equals(name)) {
zrbmOrgNames = value;
}
if (baseFieldsList.contains(name)) {
- SarStandImportDto.compareFieldAndName(name,value,sarStandardsInfoEO);
- } else if (attrFieldsList.contains(name)){
+ SarStandImportDto.compareFieldAndName(name, value, sarStandardsInfoEO);
+ } else if (attrFieldsList.contains(name)) {
// 根据name查字段
- SarStandAttrDetails fieldEO = sarStandAttrDetailsEODao.selectFieldByName(name,standType+"_STAND");
+ SarStandAttrDetails fieldEO = sarStandAttrDetailsEODao.selectFieldByName(name, standType + "_STAND");
if (fieldEO != null) {
fieldEO.setAttrValue(value);
attrList.add(fieldEO);
@@ -1208,10 +1203,10 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl beseResultMap = validateBaseDatas(sarStandardsInfoEO,standType,errorMsg,countError,standnumberlist);
+ Map beseResultMap = validateBaseDatas(sarStandardsInfoEO, standType, errorMsg, countError, standnumberlist);
errorMsg = beseResultMap.get("errorMsg");
countError = Integer.parseInt(beseResultMap.get("countError"));
- Map attrResultMap = validateAttrDatas(sarStandardsInfoEO,standType,filepath,errorMsg,countError,zrbmOrgNames);
+ Map attrResultMap = validateAttrDatas(sarStandardsInfoEO, standType, filepath, errorMsg, countError, zrbmOrgNames);
errorMsg = attrResultMap.get("errorMsg");
countError = Integer.parseInt(attrResultMap.get("countError"));
if (countError > 0) {
@@ -1235,8 +1230,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl standnumberlist) throws Exception {
- Map map = new HashMap();
+ public Map validateBaseDatas(SarStandardsInfo dto, String standType, String errorMsg, int countError, List standnumberlist) throws Exception {
+ Map map = new HashMap();
// 验证国家及关联标准类别
DicTypeEO dic = new DicTypeEO();
List getDic = new ArrayList<>();
@@ -1265,7 +1260,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl标准编号不能超过100个字符;";
countError++;
}
- String regEx="^[A-z0-9-.]*$";
+ String regEx = "^[A-z0-9-.]*$";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
if (!m.matches()) {
@@ -1297,7 +1292,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl 20) {
@@ -1347,7 +1342,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl 100){
+ if (dto.getCountry().length() > 100) {
errorMsg += "适用区域不能超过100个字符;
";
countError++;
} else {
@@ -1369,7 +1364,6 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl发布日期不能为空;";
countError++;
}
@@ -1419,8 +1413,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl map = new HashMap();
+ public Map validateAttrDatas(SarStandardsInfo dto, String standType, String filepath, String errorMsg, int countError, String zrbmOrgNames) throws Exception {
+ Map map = new HashMap();
//根据重要度判断字段必填
String isMustStr = "no";
List isMustList = new ArrayList<>();
@@ -1452,7 +1446,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl attrList = dto.getAttrInfoList();
if (attrList != null && !attrList.isEmpty()) {
if (StringUtils.isNotBlank(zrbmOrgNames)) {
- zrbmOrgNames = sysInfoEOService.getOrgIdByName(zrbmOrgNames,null);
+ zrbmOrgNames = sysInfoEOService.getOrgIdByName(zrbmOrgNames, null);
}
- Map attrInfoMap = new HashMap<>();
+ Map attrInfoMap = new HashMap<>();
for (SarStandAttrDetails detailsEO : attrList) {
// 根据不同字段类型进行不同验证
String attrType = detailsEO.getAttrType();
@@ -1477,7 +1471,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl"+attrName + "不能为空;";
+ errorMsg += "
" + attrName + "不能为空;
";
countError++;
}
if (StandAttrTypeEnum.INPUT_STR.getValue().equals(attrType)) {
@@ -1485,7 +1479,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl attrLen) {
- errorMsg += ""+attrName + "不能超过"+ attrLen +"个字符;
";
+ errorMsg += "
" + attrName + "不能超过" + attrLen + "个字符;
";
countError++;
}
}
@@ -1495,7 +1489,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl attrLen) {
- errorMsg += ""+attrName + "不能超过"+ attrLen +"个字符;
";
+ errorMsg += "
" + attrName + "不能超过" + attrLen + "个字符;
";
countError++;
}
}
int value = Integer.parseInt(attrValue);
- attrInfoMap.put(attrField,value);
+ attrInfoMap.put(attrField, value);
} else if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
String saveCode = "";
if (StringUtils.isNotEmpty(attrValue)) {
attrValue = attrValue.replace(",", ",");
String[] valueArr = attrValue.split(",");
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) && valueArr.length > 1) {
- errorMsg += "
"+attrName + "单选字段只能输入一个选项;
";
+ errorMsg += "
" + attrName + "单选字段只能输入一个选项;
";
countError++;
- } else if(valueArr.length>20){
- errorMsg += "
"+attrName + "选项不能超过20个;
";
+ } else if (valueArr.length > 20) {
+ errorMsg += "
" + attrName + "选项不能超过20个;
";
countError++;
} else if (attrValue.length() > attrLen) {
- errorMsg += "
"+attrName + "不能超过500个字符;
";
+ errorMsg += "
" + attrName + "不能超过500个字符;
";
countError++;
} else {
Set set = new HashSet();
@@ -1550,18 +1544,18 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl"+attrName + valueArr[e] + "不存在;";
+ errorMsg += "
" + attrName + valueArr[e] + "不存在;
";
countError++;
}
}
- }else if (SelectionTypeEnum.GZZXX.getValue().equals(selVal)) {
+ } else if (SelectionTypeEnum.GZZXX.getValue().equals(selVal)) {
for (int e = 0; e < valueArr.length; e++) {
set.add(valueArr[e]);
String id = sysInfoEOService.getGroupIdByNames(valueArr[e]);
if (StringUtils.isNotBlank(id)) {
saveCode += id + ',';
} else {
- errorMsg += "
"+attrName + valueArr[e] + "不存在;
";
+ errorMsg += "
" + attrName + valueArr[e] + "不存在;
";
countError++;
}
}
@@ -1576,11 +1570,11 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl"+attrName + valueArr[e] + "不存在;";
+ errorMsg += "
" + attrName + valueArr[e] + "不存在;
";
countError++;
}
}
@@ -1589,15 +1583,15 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl