|
@@ -109,8 +109,30 @@ public abstract class AutomaticReportTableValidate implements ReportTableValidat
|
|
|
if (Blank.isNotEmpty(rowCol)) {
|
|
|
//能解析的数据才赋值
|
|
|
try {
|
|
|
+ String v = rowCol.getString("v");
|
|
|
+ String regex = "^\\$\\{.*\\}$";
|
|
|
+ //赋值基础数据项
|
|
|
+ if (v != null && v.matches(regex)) {
|
|
|
+ ReportTableBasicItemEnum o = Arrays.stream(ReportTableBasicItemEnum.values())
|
|
|
+ .filter(b -> b.name().equals(v.substring(2, v.length() - 1))).findFirst().orElse(null);
|
|
|
+ if (o != null) {
|
|
|
+ String value = o.getValue();
|
|
|
+ rowCol.put("v", value);
|
|
|
+ rowCol.put("m", value);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ rowCol.put("v", null);
|
|
|
+ rowCol.put("m", null);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
JSONObject rowColJson = JSONObject.parseObject(rowCol.getString("celldata"));
|
|
|
+ if(Blank.isEmpty(rowColJson)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String type = rowColJson.getString("type");
|
|
|
+ if(Blank.isEmpty(type)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String tableId = rowColJson.getString("tableId");
|
|
|
//如果类型为数据,则存入数据
|
|
|
if (type.equals("data")) {
|
|
@@ -120,42 +142,35 @@ public abstract class AutomaticReportTableValidate implements ReportTableValidat
|
|
|
|| sheetTableDataMap.get(tableId).get(uid).isEmpty()) {
|
|
|
rowCol.put("v", null);
|
|
|
rowCol.put("m", null);
|
|
|
- } else {
|
|
|
- List<Item> itemList = sheetTableDataMap.get(tableId).get(uid);
|
|
|
- String value = itemList.get(0).getValue();
|
|
|
- rowCol.put("v", value);
|
|
|
- rowCol.put("m", value);
|
|
|
- itemList.remove(0);
|
|
|
+ continue;
|
|
|
}
|
|
|
+ List<Item> itemList = sheetTableDataMap.get(tableId).get(uid);
|
|
|
+ String value = itemList.get(0).getValue();
|
|
|
+ rowCol.put("v", value);
|
|
|
+ rowCol.put("m", value);
|
|
|
+ itemList.remove(0);
|
|
|
+ continue;
|
|
|
//如果类型为时间,则存入时间
|
|
|
- } else if (type.equals("datatime")) {
|
|
|
- if (Blank.isEmpty(sheetTableDataMap.get(tableId))
|
|
|
- || sheetTableDataMap.get(tableId).values().stream().findFirst().orElse(new ArrayList<>()).isEmpty()) {
|
|
|
+ }
|
|
|
+ if (type.equals("datatime")) {
|
|
|
+ if (Blank.isEmpty(sheetTableDataMap.get(tableId))) {
|
|
|
rowCol.put("v", null);
|
|
|
rowCol.put("m", null);
|
|
|
- } else {
|
|
|
- List<Item> itemList = sheetTableDataMap.get(tableId).values().stream().findFirst().orElse(new ArrayList<>());
|
|
|
- String time = itemList.get(0).getTime();
|
|
|
- rowCol.put("v", time);
|
|
|
- rowCol.put("m", time);
|
|
|
+ continue;
|
|
|
}
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- String v = rowCol.getString("v");
|
|
|
- String regex = "^\\$\\{.*\\}$";
|
|
|
- //赋值基础数据项
|
|
|
- if (v != null && v.matches(regex)) {
|
|
|
- if (Arrays.stream(ReportTableBasicItemEnum.values())
|
|
|
- .filter(b -> b.name().equals(v.substring(2, v.length() - 1))).findFirst().orElse(null) != null) {
|
|
|
- String value = Objects.requireNonNull(Arrays.stream(ReportTableBasicItemEnum.values())
|
|
|
- .filter(b -> b.name().equals(v.substring(2, v.length() - 1))).findFirst().orElse(null)).getValue();
|
|
|
- rowCol.put("v", value);
|
|
|
- rowCol.put("m", value);
|
|
|
- } else {
|
|
|
+
|
|
|
+ List<Item> itemList = sheetTableDataMap.get(tableId).values().stream().findFirst().orElse(new ArrayList<>());
|
|
|
+ if (itemList.isEmpty()) {
|
|
|
rowCol.put("v", null);
|
|
|
rowCol.put("m", null);
|
|
|
+ continue;
|
|
|
}
|
|
|
+ String time = itemList.get(0).getTime();
|
|
|
+ rowCol.put("v", time);
|
|
|
+ rowCol.put("m", time);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("自动报表解析数据出错",e);
|
|
|
}
|
|
|
}
|
|
|
}
|