Commit 68e80d39 authored by fangxinjiang's avatar fangxinjiang

代码优化

parent 4560adb8
...@@ -64,7 +64,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -64,7 +64,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 学历名称 * 学历名称
*/ */
@ExcelAttribute(name = "学历",errorInfo = "学历不可为空",isDataId = true,dataType = "system_degree_dict") @ExcelAttribute(name = "学历",errorInfo = "学历不可为空",isDataId = true,dataType = "education")
@NotNull(message = "学历不可为空") @NotNull(message = "学历不可为空")
@ExcelProperty(value ="学历") @ExcelProperty(value ="学历")
private String educationName; private String educationName;
......
...@@ -28,7 +28,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{ ...@@ -28,7 +28,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/** /**
* 学校名称 * 学校名称
*/ */
@ExcelAttribute(name = "学校", isNotEmpty = true,errorInfo = "学校不可为空") @ExcelAttribute(name = "学校", isNotEmpty = true,errorInfo = "学校不可为空",maxLength = 50)
@NotNull(message = "学校不可为空") @NotNull(message = "学校不可为空")
@ExcelProperty(value ="学校") @ExcelProperty(value ="学校")
private String school; private String school;
...@@ -36,7 +36,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{ ...@@ -36,7 +36,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/** /**
* 院系名称 * 院系名称
*/ */
@ExcelAttribute(name = "院系名称") @ExcelAttribute(name = "院系名称",maxLength = 50)
@ExcelProperty(value ="院系名称") @ExcelProperty(value ="院系名称")
private String collageSystem; private String collageSystem;
...@@ -44,7 +44,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{ ...@@ -44,7 +44,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/** /**
* 专业 * 专业
*/ */
@ExcelAttribute(name = "专业", isNotEmpty = true,errorInfo = "专业不可为空") @ExcelAttribute(name = "专业", isNotEmpty = true,errorInfo = "专业不可为空",maxLength = 50)
@NotNull(message = "专业不可为空") @NotNull(message = "专业不可为空")
@ExcelProperty(value ="专业") @ExcelProperty(value ="专业")
private String major; private String major;
...@@ -100,13 +100,13 @@ public class EmpEducationUpdateExcelVo extends RowIndex{ ...@@ -100,13 +100,13 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/** /**
* 证书名称 * 证书名称
*/ */
@ExcelAttribute(name = "证书名称") @ExcelAttribute(name = "证书名称",maxLength = 50)
@ExcelProperty(value ="证书名称") @ExcelProperty(value ="证书名称")
private String certificationName; private String certificationName;
/** /**
* 备注 * 备注
*/ */
@ExcelAttribute(name = "remark") @ExcelAttribute(name = "备注",maxLength = 200)
@ExcelProperty(value ="备注") @ExcelProperty(value ="备注")
private String remark; private String remark;
} }
...@@ -231,7 +231,12 @@ public class ExcelUtil <T> implements Serializable { ...@@ -231,7 +231,12 @@ public class ExcelUtil <T> implements Serializable {
//如果是需要从字典表取值数据的话在这里处理即可 //如果是需要从字典表取值数据的话在这里处理即可
if (Common.isNotNull(attr.readConverterExp())) { if (Common.isNotNull(attr.readConverterExp())) {
c = reverseByExp( c, attr.readConverterExp()); tempStr= reverseByExp( c, attr.readConverterExp());
if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的字典数据"), errorTemp);
}else {
c = tempStr;
}
} else if (attr.isDataId()) { } else if (attr.isDataId()) {
if (Common.isNotNull(attr.dataType())) { if (Common.isNotNull(attr.dataType())) {
//非区域字段处理 TODO //非区域字段处理 TODO
...@@ -351,33 +356,16 @@ public class ExcelUtil <T> implements Serializable { ...@@ -351,33 +356,16 @@ public class ExcelUtil <T> implements Serializable {
public static String reverseByExp(String propertyValue, String converterExp) throws Exception { public static String reverseByExp(String propertyValue, String converterExp) throws Exception {
try { try {
String[] convertSource = converterExp.split(","); String[] convertSource = converterExp.split(",");
if(propertyValue.contains(",")){ for (String item : convertSource) {
String[] valueSource = propertyValue.split(","); String[] itemArray = item.split("=");
propertyValue = ""; if (itemArray[1].equals(propertyValue)) {
for(String value:valueSource){ return itemArray[0];
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (itemArray[1].equals(value)) {
propertyValue += itemArray[0] + ",";
break;
}
}
}
if(propertyValue.endsWith(",")){
propertyValue = propertyValue.substring(CommonConstants.dingleDigitIntArray[0],propertyValue.length()-1);
}
}else{
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (itemArray[1].equals(propertyValue)) {
return itemArray[0];
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;
} }
return propertyValue; return null;
} }
/** /**
......
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