-
Notifications
You must be signed in to change notification settings - Fork 74
数据定义模板
斩秋 edited this page Feb 22, 2021
·
6 revisions
数据定义模板用来定义数据字段类型,分割符,采用哪种协议等等
{
"head":[
"totalCount|总笔数|Required|Integer",
"totalAmount|总金额|BigDecimal|Required"
],
"body":[
"seq|流水号",
"instSeq|基金公司订单号|Required",
"gmtApply|订单申请时间|Date:yyyy-MM-dd HH:mm:ss",
"date|普通日期|Date:yyyyMMdd",
"dateTime|普通日期时间|Date:yyyyMMdd HH:mm:ss",
"applyNumber|普通数字|BigDecimal",
"amount|金额|BigDecimal",
"age|年龄|Integer",
"longN|长整型|Long",
"bol|布尔值|Boolean",
"memo|备注"
],
"tail": [
"fileEnd|数据文件尾部字符|default:OFDCFEND"
],
"protocol":"SP",
"summaryColumnPairs":[
"totalAmount|amount"
],
"columnSplit":"|@|",
"lineBreak": "\r",
"startWithSplit": "body",
"endWithSplit": "head|body|tail",
"rowValidators": [
"com.alipay.rdf.file.validator.RowValidateExample"
]
}
组件配置项 | 配置描述 |
---|---|
head | 配置文件头中变量 要求协议模板中必须定义了头布局 即使协议模板中定义了头布局也可以不定义, 但是给文件不能有头 |
body | 文件数据定义, 必须要定义 |
tail | 配置文件尾中变量 要求协议模板中必须定义了尾布局 即使协议模板中定义了尾布局也可以不定义, 但是给文件不能有尾 |
字段配置 | head、body、tail定义了字段,字段定义通过|分割,字段定义第一个和第二个分片是字段key和描述,且位置固定,后面属性定义没有固定顺序 |
fileEncoding | 定义文件编码, 赋值给TemplateConfig.fileEncoding, 优先级 fileConfig.fileEncoding > TemplateConfig.fileEncoding > FileDefaultConfig.DEFAULT_FILE_ENCONDIG |
columnSplit | 文件数据分割符, 默认是| |
lineBreak | 生成文件行换行符,默认 \r\n, 读取文件时组件能够各种换行符类型 |
startWithSplit | startWithSplit =head|body|tail, 意思是在 head ,body, tail 行数据开始将分隔符添上 |
endWithSplit | endWithSplit = body|tail ,意思是在 body, tail 行数据尾部将分隔符添上 |
protocol | 指定文件协议(布局格式) |
summaryColumnPairs | 配置汇总字段, 读过程中行字段汇总可以和文件头中比较, 写过程中汇总行字段,最后可以写到头分片中 |
rowValidators | 业务配置的行校验器,读写过程中回调 |
字段类型 | 配置描述 | 组件默认实现 |
---|---|---|
String | java.lang.String | 是 |
Long | java.lang.Long | 是 |
Integer | java.lang.Integer | 是 |
Float | java.lang.Float | 是 |
Double | java.lang.Double | 是 |
Date | java.util.Date 示例:dateTime|普通日期时间|Date:yyyyMMdd HH:mm:ss | 是 |
BigDecimal | java.math.BigDecimal | 是 |
DigitalChar | java.lang.String 数值型字符串,都是数字 | 是 |
Boolean | java.lang.Boolean | 是 |