日期:2014-05-18 浏览次数:20813 次
public class RechargeBatch extends BaseEntity {
private String batch; //批次编号
private String cardType; //充值卡类型编号
private String cardTheme; //充值卡类型说明
private Integer cardNumber; //充值卡数量
private String cardNoStart; //充值卡开始卡号
private String cardNoEnd; //充值卡结束卡号
private Date startDate; //充值卡开始使用日期
private Date stopDate; //充值卡结束使用日期
private Date reserveStopDate; //充值卡最终保留结束使用日期
private Integer faceValue; //充值卡面值
private Set<RechargeBatchInfo> rechargeBatchInfoSet; //充值卡明细项
//省略getset方法
}
public class RechargeBatchInfo extends BaseEntity {
private String cardNo; //充值卡号
private String cardPwd; //充值卡密
private String cardStatus; //充值卡状态
private RechargeBatch rechargeBatch; //充值卡批次
//省略getset方法
}
package com.tur.demo;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Hello {
public static void main(String[] args) {
RechargeBatch batch = null;
Set<RechargeBatchInfo> batchInfos = new HashSet<RechargeBatchInfo>();
Scanner scanner = new Scanner(ClassLoader.getSystemClassLoader().getResourceAsStream("data.txt"));
Pattern batchPattern = Pattern.compile("^(.+):=(.+)$");
Map<String, String> batchFields = new HashMap<String, String>();
while (scanner.hasNext()) {
String str = scanner.nextLine();
if (str.matches("^(.+):=(.+)$")) {
Matcher matcher = batchPattern.matcher(str);
while (matcher.find()) {