소스정리
parent
3484080be3
commit
346e19a251
@ -1,17 +0,0 @@
|
||||
package util;
|
||||
|
||||
/**
|
||||
* File 처리하는 클래스에서 사용하기 위한 사용자 정의 예외<BR>
|
||||
* @author pantarei
|
||||
* @since JDK 1.4.1
|
||||
* @version 0.1, 2004-11-19 pantarei create
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class IllegalRecordException extends Exception{
|
||||
public IllegalRecordException(){
|
||||
super();
|
||||
}
|
||||
public IllegalRecordException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package util;
|
||||
|
||||
|
||||
/**
|
||||
레코드<BR>
|
||||
@author pantarei
|
||||
@since JDK 1.4.1
|
||||
@version 0.1, 2004-11-17 pantarei create
|
||||
0.2, 2006-06-12 코드 추가
|
||||
*/
|
||||
public class Record{
|
||||
protected String record;
|
||||
/**
|
||||
* 레코드 길이 체크
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
protected boolean checkLength(String record, int length){
|
||||
return record.getBytes().length == length ? true : false;
|
||||
}
|
||||
/**
|
||||
* 레코드를 byte단위로 잘라서 String 로 리턴
|
||||
* @param line
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
protected String getStringInLine(String line , int start, int end)
|
||||
{
|
||||
byte[] bTmpLine = line.getBytes();
|
||||
|
||||
return new String(bTmpLine, start, end-start);
|
||||
}
|
||||
/**
|
||||
* 레코드 Return
|
||||
* @return String
|
||||
*/
|
||||
public String getRecord() throws IllegalRecordException{
|
||||
return record;
|
||||
}
|
||||
/**
|
||||
* 레코드 Return
|
||||
* @return String
|
||||
*/
|
||||
public String getData(){
|
||||
return record;
|
||||
}
|
||||
}
|
||||
@ -1,198 +0,0 @@
|
||||
package util;
|
||||
|
||||
|
||||
/**
|
||||
* 요금단말정보(RF) 데이터 포멧<BR>
|
||||
* @author jckim
|
||||
* @since JDK 1.4.1
|
||||
* @version 0.1, 2007-11-01 초기 작성, 2011-12-12 kde 이비카드 추가 컬럼사이즈 변경.
|
||||
*/
|
||||
public class RfTerminalRecord extends Record {
|
||||
private int RECORD_LEN = 260; // 레코드 길이 2011.12.12 kde 255 -> 260
|
||||
private String worker_id, fare_office_id, booth_id, year, month, day, work_times,
|
||||
seqno, after_kbn, card_no,in_out_kbn, trans_file_create_yn,
|
||||
collect_id, levy_amount, remaind_amount, card_office_id, c_repay_kbn,
|
||||
rfid_kbn, rfid_tag1, rfid_tag2, terminal_id, sam_id, sam_seqno,
|
||||
card_seqno, before_amount, algorithm_id, key_version, e_cash_identifier,
|
||||
sam_tot_seqno, sam_collect_cnt, sam_tot_amount, sign_value, person_code,
|
||||
zipge_id, alias_no, issue_id;
|
||||
/**
|
||||
* Counstructor
|
||||
*/
|
||||
public RfTerminalRecord(String worker_id, String fare_office_id, String booth_id, String year, String month,
|
||||
String day, String work_times, String seqno, String after_kbn, String card_no,
|
||||
String in_out_kbn, String trans_file_create_yn, String collect_id, String levy_amount,
|
||||
String remaind_amount, String card_office_id, String c_repay_kbn, String rfid_kbn,
|
||||
String rfid_tag1, String rfid_tag2, String terminal_id, String sam_id,
|
||||
String sam_seqno, String card_seqno, String before_amount, String algorithm_id,
|
||||
String key_version, String e_cash_identifier, String sam_tot_seqno, String sam_collect_cnt,
|
||||
String sam_tot_amount, String sign_value, String person_code, String zipge_id,
|
||||
String alias_no, String issue_id){
|
||||
this.worker_id = worker_id ;
|
||||
this.fare_office_id = fare_office_id;
|
||||
this.booth_id = booth_id ;
|
||||
this.year = year ;
|
||||
this.month = month ;
|
||||
this.day = day ;
|
||||
this.work_times = work_times ;
|
||||
this.seqno = StringUtil.justify(StringUtil.RIGHT,seqno , "0", 9);
|
||||
this.after_kbn = StringUtil.justify(StringUtil.LEFT ,after_kbn , " ", 1);
|
||||
this.card_no = StringUtil.justify(StringUtil.LEFT ,card_no , " ", 20);
|
||||
this.in_out_kbn = StringUtil.justify(StringUtil.LEFT ,in_out_kbn , " ", 1);
|
||||
this.trans_file_create_yn= StringUtil.justify(StringUtil.LEFT ,trans_file_create_yn, " ", 1);
|
||||
this.collect_id = StringUtil.justify(StringUtil.LEFT ,collect_id , " ", 2);
|
||||
this.levy_amount = StringUtil.justify(StringUtil.RIGHT,levy_amount , "0", 10);
|
||||
this.remaind_amount = StringUtil.justify(StringUtil.RIGHT,remaind_amount , "0", 10);
|
||||
this.card_office_id = StringUtil.justify(StringUtil.LEFT ,card_office_id , " ", 1);
|
||||
this.c_repay_kbn = StringUtil.justify(StringUtil.LEFT ,c_repay_kbn , " ", 1);
|
||||
this.rfid_kbn = StringUtil.justify(StringUtil.LEFT ,rfid_kbn , " ", 2);
|
||||
this.rfid_tag1 = StringUtil.justify(StringUtil.LEFT ,rfid_tag1 , " ", 24);
|
||||
this.rfid_tag2 = StringUtil.justify(StringUtil.LEFT ,rfid_tag2 , " ", 24);
|
||||
this.terminal_id = StringUtil.justify(StringUtil.LEFT ,terminal_id , " ", 9);
|
||||
this.sam_id = StringUtil.justify(StringUtil.LEFT ,sam_id , " ", 16);
|
||||
this.sam_seqno = StringUtil.justify(StringUtil.RIGHT,sam_seqno , "0", 10);
|
||||
this.card_seqno = StringUtil.justify(StringUtil.RIGHT,card_seqno , "0", 10);
|
||||
this.before_amount = StringUtil.justify(StringUtil.RIGHT,before_amount , "0", 10);
|
||||
this.algorithm_id = StringUtil.justify(StringUtil.LEFT ,algorithm_id , " ", 3); // 2011.12.12 kde 2 -> 3
|
||||
this.key_version = StringUtil.justify(StringUtil.LEFT ,key_version , " ", 3); // 2011.12.12 kde 2 -> 3
|
||||
this.e_cash_identifier = StringUtil.justify(StringUtil.LEFT ,e_cash_identifier , " ", 3); // 2011.12.12 kde 2 -> 3
|
||||
this.sam_tot_seqno = StringUtil.justify(StringUtil.RIGHT,sam_tot_seqno , "0", 10);
|
||||
this.sam_collect_cnt = StringUtil.justify(StringUtil.RIGHT,sam_collect_cnt , "0", 5);
|
||||
this.sam_tot_amount = StringUtil.justify(StringUtil.RIGHT,sam_tot_amount , "0", 10);
|
||||
this.sign_value = StringUtil.justify(StringUtil.LEFT ,sign_value , " ", 10); // 2011.12.12 kde 8 -> 10
|
||||
this.person_code = StringUtil.justify(StringUtil.LEFT ,person_code , " ", 2);
|
||||
this.zipge_id = StringUtil.justify(StringUtil.LEFT ,zipge_id , " ", 12);
|
||||
this.alias_no = StringUtil.justify(StringUtil.LEFT ,alias_no , " ", 10);
|
||||
this.issue_id = StringUtil.justify(StringUtil.LEFT ,issue_id , " ", 7);
|
||||
}
|
||||
/**
|
||||
* 레코드 정보를 String으로 return
|
||||
* @return String
|
||||
* @throws IllegalRecordException
|
||||
*/
|
||||
public String getRecord() throws IllegalRecordException{
|
||||
String result
|
||||
= new StringBuffer(worker_id )
|
||||
.append(fare_office_id )
|
||||
.append(booth_id )
|
||||
.append(year )
|
||||
.append(month )
|
||||
.append(day )
|
||||
.append(work_times )
|
||||
.append(seqno )
|
||||
.append(after_kbn )
|
||||
.append(card_no )
|
||||
.append(in_out_kbn )
|
||||
.append(trans_file_create_yn)
|
||||
.append(collect_id )
|
||||
.append(levy_amount )
|
||||
.append(remaind_amount )
|
||||
.append(card_office_id )
|
||||
.append(c_repay_kbn )
|
||||
.append(rfid_kbn )
|
||||
.append(rfid_tag1 )
|
||||
.append(rfid_tag2 )
|
||||
.append(terminal_id )
|
||||
.append(sam_id )
|
||||
.append(sam_seqno )
|
||||
.append(card_seqno )
|
||||
.append(before_amount )
|
||||
.append(algorithm_id )
|
||||
.append(key_version )
|
||||
.append(e_cash_identifier )
|
||||
.append(sam_tot_seqno )
|
||||
.append(sam_collect_cnt )
|
||||
.append(sam_tot_amount )
|
||||
.append(sign_value )
|
||||
.append(person_code )
|
||||
.append(zipge_id )
|
||||
.append(alias_no )
|
||||
.append(issue_id ).toString();
|
||||
|
||||
getRecord2();
|
||||
//System.out.println("=== " + result);
|
||||
if(checkLength(result, RECORD_LEN)){
|
||||
return result;
|
||||
}else{
|
||||
throw new IllegalRecordException(
|
||||
"Cannot create DATA record : [" + result.length() + "] " + result);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRecord2() throws IllegalRecordException{
|
||||
String result
|
||||
= new StringBuffer(worker_id )
|
||||
.append(", " )
|
||||
.append(fare_office_id )
|
||||
.append(", " )
|
||||
.append(booth_id )
|
||||
.append(", " )
|
||||
.append(year )
|
||||
.append(", " )
|
||||
.append(month )
|
||||
.append(", " )
|
||||
.append(day )
|
||||
.append(", " )
|
||||
.append(work_times )
|
||||
.append(", " )
|
||||
.append(seqno )
|
||||
.append(", " )
|
||||
.append(after_kbn )
|
||||
.append(", " )
|
||||
.append(card_no )
|
||||
.append(", " )
|
||||
.append(in_out_kbn )
|
||||
.append(", " )
|
||||
.append(trans_file_create_yn)
|
||||
.append(", " )
|
||||
.append(collect_id )
|
||||
.append(levy_amount )
|
||||
.append(", " )
|
||||
.append(remaind_amount )
|
||||
.append(", " )
|
||||
.append(card_office_id )
|
||||
.append(", " )
|
||||
.append(c_repay_kbn )
|
||||
.append(", " )
|
||||
.append(rfid_kbn )
|
||||
.append(", " )
|
||||
.append(rfid_tag1 )
|
||||
.append(", " )
|
||||
.append(rfid_tag2 )
|
||||
.append(", " )
|
||||
.append(terminal_id )
|
||||
.append(", " )
|
||||
.append(sam_id )
|
||||
.append(", " )
|
||||
.append(sam_seqno )
|
||||
.append(", " )
|
||||
.append(card_seqno )
|
||||
.append(", " )
|
||||
.append(before_amount )
|
||||
.append(", " )
|
||||
.append(algorithm_id )
|
||||
.append(", " )
|
||||
.append(key_version )
|
||||
.append(", " )
|
||||
.append(e_cash_identifier )
|
||||
.append(", " )
|
||||
.append(sam_tot_seqno )
|
||||
.append(", " )
|
||||
.append(sam_collect_cnt )
|
||||
.append(", " )
|
||||
.append(sam_tot_amount )
|
||||
.append(", " )
|
||||
.append(sign_value )
|
||||
.append(", " )
|
||||
.append(person_code )
|
||||
.append(", " )
|
||||
.append(zipge_id )
|
||||
.append(", " )
|
||||
.append(alias_no )
|
||||
.append(", " )
|
||||
.append(issue_id ).toString();
|
||||
System.out.println(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue