String temporaypath = m_strLogFilePath + "uniqueDateId.csv";
File out = new File(temporaypath);
if (!out.exists()) {
out.createNewFile();
}
FileInputStream fin = new FileInputStream(out);
BufferedReader buffreader = new BufferedReader(new InputStreamReader(fin));
String content = "";
String strFile = "";
while ((content = buffreader.readLine()) != null) {
System.out.println("data : " + content);
strFile = content;
}
buffreader.close();
if (strFile != null && strFile.trim().length() > 0) {
String strDate = strFile.substring(2, 4);
SimpleDateFormat sdff = new SimpleDateFormat("dd");
Date das = Calendar.getInstance().getTime();
String currdate = sdff.format(das);
System.out.println("curdate : " + currdate);
File sourceObjFile = null;
String strDestFile = "";
if (strDate.equalsIgnoreCase(currdate)) {
System.out.println("k");
String strSourceFilePath = m_strLogFilePath + strFile + ".csv";
sourceObjFile = new File(strSourceFilePath);
strDestFile = m_strLogFilePath + reportDate1 + reportTime1 + ".csv";
System.out.println("" + strDestFile);
File destFile = new File(strDestFile);
sourceObjFile.renameTo(destFile);
VoiceUtil.writeContentToFile(strDestFile, msisdn + "," + action + "," + shortcode + "," + reportDate2 + "\r", true);
VoiceUtil.writeContentToFile(temporaypath, reportDate1 + reportTime1, false);
} else {
String strCDRFile = m_strLogFilePath + reportDate1 + reportTime1 + ".csv";
System.out.println("==" + strCDRFile);
File file = new File(strCDRFile);
file.createNewFile();
VoiceUtil.writeContentToFile(strCDRFile, msisdn + "," + action + "," + shortcode + "," + reportDate2 + "\r", true);
VoiceUtil.writeContentToFile(temporaypath, reportDate1 + reportTime1, false);
}
} else {
String strCDRFile = m_strLogFilePath + reportDate1 + reportTime1 + ".csv";
System.out.println("==" + strCDRFile);
File file = new File(strCDRFile);
file.createNewFile();
VoiceUtil.writeContentToFile(strCDRFile, msisdn + "," + action + "," + shortcode + "," + reportDate2 + "\r", true);
VoiceUtil.writeContentToFile(temporaypath, reportDate1 + reportTime1, false);
}
No comments:
Post a Comment