Commit 81133bc8 authored by 赵建伟's avatar 赵建伟

add and test import excel codes

parent 8414dae4
......@@ -7,26 +7,26 @@ import lombok.Data;
@Data
public class DqReferRuleDto extends BaseRowModel{
@ExcelProperty(value = "校验类型",index = 1)
@ExcelProperty(value = "校验类型",index = 0)
private String checkType;
@ExcelProperty(value = "是否启用",index = 2)
@ExcelProperty(value = "是否启用",index = 1)
private Integer isValid;
@ExcelProperty(value = "校验时间",index = 3)
@ExcelProperty(value = "校验时间",index = 2)
private String checkTime;
@ExcelProperty(value = "校验数据库名",index = 4)
@ExcelProperty(value = "校验数据库名",index = 3)
private String checkDbName;
@ExcelProperty(value = "校验数据表名",index = 5)
@ExcelProperty(value = "校验数据表名",index = 4)
private String checkTbName;
@ExcelProperty(value = "校验数据列名",index = 6)
@ExcelProperty(value = "校验数据列名",index = 5)
private String checkColName;
@ExcelProperty(value = "校验表过滤条件",index = 7)
@ExcelProperty(value = "校验表过滤条件",index = 6)
private String checkFilters;
@ExcelProperty(value = "参照数据库名",index = 8)
@ExcelProperty(value = "参照数据库名",index = 7)
private String referDbName;
@ExcelProperty(value = "参照数据表名",index = 9)
@ExcelProperty(value = "参照数据表名",index = 8)
private String referTbName;
@ExcelProperty(value = "参照数据列名",index = 10)
@ExcelProperty(value = "参照数据列名",index = 9)
private String referColName;
@ExcelProperty(value = "参照表过滤条件",index = 11)
@ExcelProperty(value = "参照表过滤条件",index = 10)
private String referFilters;
}
......@@ -7,24 +7,24 @@ import lombok.Data;
@Data
public class DqSpecialRuleDto extends BaseRowModel {
@ExcelProperty(value = "校验类型", index = 1)
@ExcelProperty(value = "校验类型", index = 0)
private String checkType;
@ExcelProperty(value = "是否启用", index = 2)
@ExcelProperty(value = "是否启用", index = 1)
private Integer isValid;
@ExcelProperty(value = "校验时间", index = 3)
@ExcelProperty(value = "校验时间", index = 2)
private String checkTime;
@ExcelProperty(value = "数据库名", index = 4)
@ExcelProperty(value = "数据库名", index = 3)
private String dbName;
@ExcelProperty(value = "数据表名", index = 5)
@ExcelProperty(value = "数据表名", index = 4)
private String tbName;
@ExcelProperty(value = "数据列名", index = 6)
@ExcelProperty(value = "数据列名", index = 5)
private String colName;
@ExcelProperty(value = "数据时间列名", index = 7)
@ExcelProperty(value = "数据时间列名", index = 6)
private String timeColName;
@ExcelProperty(value = "指标类型", index = 8)
@ExcelProperty(value = "指标类型", index = 7)
private String indicatorType;
@ExcelProperty(value = "数据校验起始时间", index = 9)
@ExcelProperty(value = "数据校验起始时间", index = 8)
private String startTime;
@ExcelProperty(value = "过滤条件", index = 10)
@ExcelProperty(value = "过滤条件", index = 9)
private String filters;
}
......@@ -7,18 +7,18 @@ import lombok.Data;
@Data
public class DqUnblankRuleDto extends BaseRowModel{
@ExcelProperty(value = "校验类型", index = 1)
@ExcelProperty(value = "校验类型", index = 0)
private String checkType;
@ExcelProperty(value = "是否启用", index = 2)
@ExcelProperty(value = "是否启用", index = 1)
private Integer isValid;
@ExcelProperty(value = "校验时间", index = 3)
@ExcelProperty(value = "校验时间", index = 2)
private String checkTime;
@ExcelProperty(value = "数据库名", index = 4)
@ExcelProperty(value = "数据库名", index = 3)
private String dbName;
@ExcelProperty(value = "数据表名", index = 5)
@ExcelProperty(value = "数据表名", index = 4)
private String tbName;
@ExcelProperty(value = "数据列名", index = 6)
@ExcelProperty(value = "数据列名", index = 5)
private String colName;
@ExcelProperty(value = "过滤条件", index = 7)
@ExcelProperty(value = "过滤条件", index = 6)
private String filters;
}
......@@ -7,18 +7,24 @@ import lombok.Data;
@Data
public class DqUniqueRuleDto extends BaseRowModel{
@ExcelProperty(value = "校验类型", index = 1)
@ExcelProperty(value = "校验类型", index = 0)
private String checkType;
@ExcelProperty(value = "是否启用", index = 2)
@ExcelProperty(value = "是否启用", index = 1)
private Integer isValid;
@ExcelProperty(value = "校验时间", index = 3)
@ExcelProperty(value = "校验时间", index = 2)
private String checkTime;
@ExcelProperty(value = "数据库名", index = 4)
@ExcelProperty(value = "数据库名", index = 3)
private String dbName;
@ExcelProperty(value = "数据表名", index = 5)
@ExcelProperty(value = "数据表名", index = 4)
private String tbName;
@ExcelProperty(value = "数据列名", index = 6)
@ExcelProperty(value = "数据列名", index = 5)
private String colName;
@ExcelProperty(value = "过滤条件", index = 7)
@ExcelProperty(value = "过滤条件", index = 6)
private String filters;
@Override
public String toString() {
return "DqUniqueRuleDto [checkType=" + checkType + ", isValid=" + isValid + ", checkTime=" + checkTime
+ ", dbName=" + dbName + ", tbName=" + tbName + ", colName=" + colName + ", filters=" + filters + "]";
}
}
......@@ -7,20 +7,20 @@ import lombok.Data;
@Data
public class DqVolatilityRuleDto extends BaseRowModel{
@ExcelProperty(value = "校验类型", index = 1)
@ExcelProperty(value = "校验类型", index = 0)
private String checkType;
@ExcelProperty(value = "是否启用", index = 2)
@ExcelProperty(value = "是否启用", index = 1)
private Integer isValid;
@ExcelProperty(value = "校验时间", index = 3)
@ExcelProperty(value = "校验时间", index = 2)
private String checkTime;
@ExcelProperty(value = "数据库名", index = 4)
@ExcelProperty(value = "数据库名", index = 3)
private String dbName;
@ExcelProperty(value = "数据表名", index = 5)
@ExcelProperty(value = "数据表名", index = 4)
private String tbName;
@ExcelProperty(value = "数据列名", index = 6)
@ExcelProperty(value = "数据列名", index = 5)
private String colName;
@ExcelProperty(value = "指标类型", index = 7)
@ExcelProperty(value = "指标类型", index = 6)
private String indicatorType;
@ExcelProperty(value = "过滤条件", index = 8)
@ExcelProperty(value = "过滤条件", index = 7)
private String filters;
}
......@@ -39,6 +39,7 @@ public class UniqueExcelListener extends AnalysisEventListener<Object> {
public void doSomething(){
for (Object o:data) {
String jsonString = JSONObject.toJSONString(o);
System.out.println(jsonString);
JSONObject jsonObject = JSONObject.parseObject(jsonString);
DqRuleVo dqRuleVo = JSON.toJavaObject(jsonObject, DqRuleVo.class);
dqRuleService.addDqRule(dqRuleVo);
......
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