|
|
|
|
@ -2,6 +2,7 @@ package cokr.xit.fims.nxrp.support;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileWriter;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
@ -10,34 +11,29 @@ import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
|
|
|
|
|
public class OnlyTxtMaker extends LinkFileMaker {
|
|
|
|
|
|
|
|
|
|
private String innerFilePrefix;
|
|
|
|
|
private String txtFileName;
|
|
|
|
|
|
|
|
|
|
private int innerFileIndex = 0;
|
|
|
|
|
private FileWriter fileWriter;
|
|
|
|
|
|
|
|
|
|
public OnlyTxtMaker(String instDigit7){
|
|
|
|
|
|
|
|
|
|
public OnlyTxtMaker(String systemCode){
|
|
|
|
|
String ifId = "EBF_Z000001LGE_1741000NIS_2001";
|
|
|
|
|
String systemCode = "ECA";
|
|
|
|
|
|
|
|
|
|
this.ifId = ifId;
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
|
|
String currentTime = ymdhmsFormat.format(new Date());
|
|
|
|
|
|
|
|
|
|
zipFileName = ifId + "_" + currentTime + "@" + instDigit7 + systemCode + ".zip";
|
|
|
|
|
zipFileName = ifId + "_" + currentTime + "@6510000" + systemCode + ".zip";
|
|
|
|
|
txtFileName = ifId + "_" + currentTime + "@6510000" + systemCode + ".txt";
|
|
|
|
|
|
|
|
|
|
innerFilePrefix = ifId + "_" + currentTime + "_" + instDigit7 + "_";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getTextFileName() {
|
|
|
|
|
return innerFilePrefix + innerFileIndex + ".txt";
|
|
|
|
|
return txtFileName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void increaseInnerFileIndex() {
|
|
|
|
|
innerFileIndex++;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public UnnamedItems extract(DataObject rentInfo, String sggCd, String taskSeCd) {
|
|
|
|
|
UnnamedItems u = new UnnamedItems();
|
|
|
|
|
@ -55,26 +51,45 @@ public class OnlyTxtMaker extends LinkFileMaker {
|
|
|
|
|
return u;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void writeTextFileContents(String workPath, String... contents) {
|
|
|
|
|
public void startTxt(String workPath) {
|
|
|
|
|
try {
|
|
|
|
|
File txtFile = new File(workPath + "/" + getTextFileName());
|
|
|
|
|
if(!txtFile.createNewFile()) {
|
|
|
|
|
throw new RuntimeException("[F]파일 생성 오류");
|
|
|
|
|
}
|
|
|
|
|
fileWriter = new FileWriter(txtFile);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void endTxt() {
|
|
|
|
|
try {
|
|
|
|
|
fileWriter.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileWriter fileWriter = new FileWriter(txtFile);
|
|
|
|
|
public void newLine() {
|
|
|
|
|
try {
|
|
|
|
|
fileWriter.write("\r\n");
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void writeLine(String workPath, String... contents) {
|
|
|
|
|
try {
|
|
|
|
|
for(int i=0; i < contents.length; i++) {
|
|
|
|
|
if(i != 0) {
|
|
|
|
|
fileWriter.write("|");
|
|
|
|
|
}
|
|
|
|
|
fileWriter.write(contents[i]);
|
|
|
|
|
}
|
|
|
|
|
fileWriter.close();
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException("[F]"+e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|