Commit 68eed82f authored by fangxinjiang's avatar fangxinjiang

代码优化

parent c996743e
......@@ -249,13 +249,13 @@ public class ExcelUtil <T> implements Serializable {
} else {
if (attr.isArea()) {
//区域字段处理 TODO
if (!Common.isNotNull(attr.parentField())) {
tempStr = getDicValue("area_"+c.trim(), tempStr, attr,rowNum,errorTemp);
} else {
// TODO
tempStr = getDicValue("area_"+c.trim()+ "_" + getFieldValueByName(attr.parentField(), data, DateUtil.ISO_EXPANDED_DATE_FORMAT), tempStr, attr,rowNum,errorTemp);
}
//区域字段处理 TODO
if (!Common.isNotNull(attr.parentField())) {
tempStr = getAreaValue("area_"+c.trim(), tempStr, attr,rowNum,errorTemp);
} else {
// TODO
tempStr = getAreaValue("area_"+c.trim()+ "_" + getFieldValueByName(attr.parentField(), data, DateUtil.ISO_EXPANDED_DATE_FORMAT), tempStr, attr,rowNum,errorTemp);
}
} else {
//直接按值去找数据 TODO
tempStr = getDicValue(c.trim() , tempStr, attr,rowNum,errorTemp);
......@@ -408,13 +408,16 @@ public class ExcelUtil <T> implements Serializable {
return propertyValue;
}
private String getAreaLabel(String c, ExcelAttribute attr) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(attr.dataType());
for (Map.Entry<String,String> entry:dicObj.entrySet()){
if (Common.isNotNull(entry.getValue()) && entry.getValue().equals(c.trim())){
return entry.getKey();
}
return (String)RedisUtil.redis.opsForValue().get(c);
}
private String getAreaValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
tempStr = (String)RedisUtil.redis.opsForValue().get(c);
if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
return CommonConstants.EMPTY_STRING;
}
return null;
return tempStr;
}
private String getDicValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(attr.dataType());
......
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