Commit fdd0228e authored by Ketan Patil's avatar Ketan Patil

Replace SFAMonthlyReport.java

parent 3ddb8003
/* */ package ibase.webitm.ejb.sc; package ibase.webitm.ejb.sc;
/* */ /**
/* */ import ibase.scheduler.utility.interfaces.Schedule; * Author :- Amit Shrivastava
/* */ import ibase.system.config.ConnDriver; * Component :- SFAMonthlyReport.java
/* */ import ibase.utility.CommonConstants; * Req Id:- [F16GSUN003]
/* */ import ibase.utility.E12GenericUtility; * Date [27/feb/20]
/* */ import ibase.utility.UserInfoBean; * */
/* */ import ibase.webitm.ejb.DBAccessEJB;
/* */ import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.DBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
/* */ import ibase.webitm.utility.ITMException;
/* */ import java.io.File; import ibase.webitm.utility.ITMException;
/* */ import java.io.FileNotFoundException;
/* */ import java.io.FileWriter; import java.io.File;
/* */ import java.io.IOException; import java.io.FileNotFoundException;
/* */ import java.io.PrintStream; import java.io.FileWriter;
/* */ import java.io.PrintWriter; import java.io.IOException;
/* */ import java.sql.Connection; import java.io.PrintWriter;
/* */ import java.sql.PreparedStatement; import java.sql.Connection;
/* */ import java.sql.ResultSet; import java.sql.PreparedStatement;
/* */ import java.sql.ResultSetMetaData; import java.sql.ResultSet;
/* */ import java.sql.SQLException; import java.sql.ResultSetMetaData;
/* */ import java.sql.Statement; import java.sql.SQLException;
/* */ import java.sql.Timestamp; import java.sql.Statement;
/* */ import java.text.SimpleDateFormat; import java.sql.Timestamp;
/* */ import java.util.ArrayList; import java.text.SimpleDateFormat;
/* */ import java.util.Calendar; import java.util.ArrayList;
/* */ import java.util.Date; import java.util.Calendar;
/* */ import java.util.HashMap; import java.util.Date;
/* */ import java.util.HashMap;
/* */ public class SFAMonthlyReport
/* */ implements Schedule import com.itextpdf.text.log.SysoCounter;
/* */ {
/* 43 */ String userInfoXml = ""; import ibase.utility.UserInfoBean;
/* */ public class SFAMonthlyReport implements Schedule
/* 49 */ E12GenericUtility genericUtility = new E12GenericUtility(); {
/* 50 */ ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); String userInfoXml = "";
/* */
/* */ public String schedule(HashMap arg0) /* public static void main(String[] args) {
/* */ throws Exception // TODO Auto-generated method stub
/* */ {
/* 55 */ return null; }*/
/* */ } E12GenericUtility genericUtility = new E12GenericUtility();
/* */ ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
/* */ public String schedule(String scheduleParamXML) @Override
/* */ throws Exception public String schedule(HashMap arg0) throws Exception
/* */ { {
/* 61 */ ConnDriver connDriver = new ConnDriver(); // TODO Auto-generated method stub
/* 62 */ Connection conn = null; return null;
/* 63 */ PreparedStatement pstmt = null; PreparedStatement pstmt1 = null; }
/* 64 */ ResultSet rs = null;
/* */ @Override
/* 67 */ int fileNameCount = 0; String sqlExpr = ""; String sqlExpr1 = ""; String sqlExpr2 = ""; String sqlExpr3 = ""; String sqlExpr4 = ""; String sqlExpr5 = ""; String sqlExpr6 = ""; String objtNames = ""; String compSql = ""; public String schedule(String scheduleParamXML) throws Exception
/* 68 */ String siteCodeStrSale = ""; {
/* */ try ConnDriver connDriver = new ConnDriver();
/* */ { Connection conn = null;
/* 71 */ System.out.println("Before userInfoXml:::[" + this.userInfoXml + "]" + "Before scheduleParamXML>> " + scheduleParamXML); PreparedStatement pstmt = null,pstmt1=null;
/* 72 */ this.userInfoXml = scheduleParamXML; ResultSet rs=null;
/* 73 */ System.out.println("userInfoXml:::[" + this.userInfoXml + "]" + "scheduleParamXML>> " + scheduleParamXML);
/* 74 */ UserInfoBean userInfo = new UserInfoBean(this.userInfoXml);
/* 75 */ System.out.println("userInfo > Amit > " + userInfo); int fileNameCount = 0;String sqlExpr = "", sqlExpr1 = "", sqlExpr2 = "", sqlExpr3 = "", sqlExpr4 = "", sqlExpr5 = "", sqlExpr6 = "",objtNames="",compSql="";
/* 76 */ String transDB = userInfo.getTransDB(); String siteCodeStrSale="";
/* 77 */ System.out.println("get TransDB connection in updateStatus : " + transDB); try
/* 78 */ if ((transDB != null) && (transDB.trim().length() > 0)) {
/* */ { System.out.println("Before userInfoXml:::[" + this.userInfoXml + "]"+"Before scheduleParamXML>> "+scheduleParamXML);
/* 80 */ conn = connDriver.getConnectDB(transDB); this.userInfoXml = scheduleParamXML;
/* */ } System.out.println("userInfoXml:::[" + this.userInfoXml + "]"+"scheduleParamXML>> "+scheduleParamXML);
/* */ else UserInfoBean userInfo = new UserInfoBean(this.userInfoXml);
/* */ { System.out.println("userInfo > Amit > " +userInfo);
/* 84 */ conn = connDriver.getConnectDB("DriverITM"); String transDB = userInfo.getTransDB();
/* */ } System.out.println("get TransDB connection in updateStatus : " + transDB);
/* */ if ((transDB != null) && (transDB.trim().length() > 0))
/* 102 */ System.out.println("@V@ In schedule method"); {
/* */ conn = connDriver.getConnectDB(transDB);
/* 106 */ System.out.println("@V@ In schedule method"); }
/* */ else
/* 112 */ String fldValue = ""; String fldValue1 = ""; String fldValue2 = ""; {
/* */ conn = connDriver.getConnectDB("DriverITM");
/* 117 */ ArrayList al = new ArrayList(); }
/* 118 */ ArrayList bl = new ArrayList();
/* */ /*String loginCode=getValueFromXTRAPARAMS(xtraparams);
/* 120 */ String query = "SELECT count(*) FROM GENCODES where FLD_NAME='SFARP' and MOD_NAME='SFAREPORT' "; UserInfoBean userInfo = new UserInfoBean();
/* */ DBAccessEJB dbAccessEJB = new DBAccessEJB();
/* 122 */ pstmt = conn.prepareStatement(query); userInfo = dbAccessEJB.createUserInfo(loginCode);
/* 123 */ rs = pstmt.executeQuery(); transDb = userInfo.getTransDB();*/
/* 124 */ int FCounter = 0; /*System.out.println("transDb::::@@@ " + scheduleParamXML);
/* 125 */ if (rs.next()) if ((scheduleParamXML != null) && (scheduleParamXML.trim().length() > 0))
/* */ { {
/* 127 */ fileNameCount = rs.getInt(1); conn = connDriver.getConnectDB(scheduleParamXML);
/* */ } }
/* 129 */ rs.close(); else
/* 130 */ pstmt.close(); {
/* */ conn = connDriver.getConnectDB("DriverITM");
/* 132 */ System.out.println("@V@ Count is =>[" + fileNameCount + "]<=Getting files @V@"); }*/
/* */
/* 134 */ String[] fileNames = new String[fileNameCount]; System.out.println("@V@ In schedule method");
/* */ // conn = connDriver.getConnectDB("DriverITM");
/* 136 */ query = "SELECT fld_value, descr FROM GENCODES where FLD_NAME='SFARP' and MOD_NAME='SFAREPORT' order by to_number(fld_value)"; // System.out.println("@V@ In schedule method");
/* 137 */ pstmt = conn.prepareStatement(query); String query ;
/* 138 */ rs = pstmt.executeQuery(); System.out.println("@V@ In schedule method");
/* */
/* 140 */ while (rs.next())
/* */ {
/* 142 */ fileNameCount = rs.getInt(1);
/* 143 */ fileNames[FCounter] = rs.getString(2);
/* 144 */ System.out.println("@V@ File no [" + FCounter + "] = [" + fileNames[FCounter] + "]"); String fldValue="",fldValue1="",fldValue2="";
/* 145 */ FCounter++; /*[START] SANKET GIRME [19-Apr-2016]
/* */ } * To get the dynamically file names and count of the files.
/* 147 */ fileNameCount = fileNames.length; * */
/* 148 */ System.out.println("@V@ Final Count of Files:- [" + fileNameCount + "]");
/* 149 */ System.out.println("@V@ Final Name of Files:- [" + fileNames[1] + "]"); ArrayList<String> al =new ArrayList<String>();
/* 150 */ pstmt.close(); ArrayList<String> bl =new ArrayList<String>();
/* 151 */ rs.close();
/* */ query = "SELECT count(*) FROM GENCODES where FLD_NAME='SFARP' and MOD_NAME='SFAREPORT' ";
/* 173 */ for (int i = 1; i <= fileNameCount; i++) //query = "SELECT fld_value,descr FROM GENCODES where FLD_NAME='SFARS' and MOD_NAME='W_D_GIFT_DISTRIBUTION_DATA_NEW' ";
/* */ { pstmt = conn.prepareStatement(query);
/* 178 */ String sql = "select sql_expr,sql_input,sql_expr1,sql_expr2,sql_expr3,sql_expr4,sql_expr5,sql_expr6 from TAX_BAL_GRP_DET where BAL_GROUP='SFARP' and to_number(LINE_NO)=" + i + rs = pstmt.executeQuery();
/* 179 */ " order by to_number(line_no)"; int FCounter = 0;
/* 180 */ pstmt = conn.prepareStatement(sql); if(rs.next())
/* */ {
/* 182 */ rs = pstmt.executeQuery(); fileNameCount = rs.getInt(1);
/* 183 */ if (!rs.next()) { }
/* */ continue; rs.close();
/* */ } pstmt.close();
/* 186 */ sqlExpr = checkNull(rs.getString("sql_expr"));
/* 187 */ sqlExpr1 = checkNull(rs.getString("sql_expr1")); System.out.println("@V@ Count is =>["+fileNameCount+"]<=Getting files @V@");
/* 188 */ sqlExpr2 = checkNull(rs.getString("sql_expr2"));
/* 189 */ sqlExpr3 = checkNull(rs.getString("sql_expr3")); String[] fileNames = new String[fileNameCount] ;
/* 190 */ sqlExpr4 = checkNull(rs.getString("sql_expr4"));
/* 191 */ sqlExpr5 = checkNull(rs.getString("sql_expr5")); query = "SELECT fld_value, descr FROM GENCODES where FLD_NAME='SFARP' and MOD_NAME='SFAREPORT' order by to_number(fld_value)";// change SSCGRP -> SSCGRP1
/* 192 */ sqlExpr6 = checkNull(rs.getString("sql_expr6")); pstmt = conn.prepareStatement(query);
/* 193 */ objtNames = checkNull(rs.getString("sql_input")); rs = pstmt.executeQuery();
/* */
/* 195 */ compSql = sqlExpr + " " + sqlExpr1 + " " + sqlExpr2 + " " + sqlExpr3 + " " + sqlExpr4 + " " + sqlExpr5 + " " + while(rs.next())
/* 196 */ sqlExpr6; {
/* 197 */ System.out.println("Combine SQL::::" + compSql); fileNameCount = rs.getInt(1);
/* */ fileNames[FCounter] = rs.getString(2); ;
/* 199 */ System.out.println("inside execute dynamically Sql "); System.out.println("@V@ File no ["+FCounter+"] = ["+fileNames[FCounter]+"]");
/* */ FCounter++;
/* 201 */ processQuery(compSql, fileNames[(i - 1)], conn); }
/* */ } fileNameCount = fileNames.length;
/* */ System.out.println("@V@ Final Count of Files:- ["+fileNameCount+"]");
/* */ } System.out.println("@V@ Final Name of Files:- ["+fileNames[1]+"]");
/* */ catch (Exception ee) pstmt.close();
/* */ { rs.close();
/* 208 */ System.out.println("@ Amit>> Error in [SFADailyReport.java]=>" + ee);
/* 209 */ ee.printStackTrace(); //String[] fileNames = new String[fileNameCount] ;
/* */ }
/* */ finally // query = "SELECT fld_value, descr FROM GENCODES where FLD_NAME='SSC' and MOD_NAME='SSCGRP' order by to_number(fld_value) ";// change SSCGRP -> SSCGRP1
/* */ { /*query = "SELECT fld_value, descr FROM GENCODES where FLD_NAME='SFA' and MOD_NAME='SFAGRP1'";// change SSCGRP -> SSCGRP1
/* 214 */ if ((conn != null) && (rs != null) && (pstmt1 != null)) pstmt = conn.prepareStatement(query);
/* */ { rs = pstmt.executeQuery();
/* 216 */ conn.close();
/* 217 */ rs.close(); while(rs.next())
/* 218 */ pstmt.close(); {
/* */ } fileNameCount = rs.getInt(1);
/* */ } fileNames[FCounter] = rs.getString(2); ;
/* */ System.out.println("@V@ File no ["+FCounter+"] = ["+fileNames[FCounter]+"]");
/* 222 */ return ""; FCounter++;
/* */ } }
/* */
/* */ String changeType(Object obj) System.out.println("@V@ Final Count of Files:- ["+fileNameCount+"]");
/* */ { System.out.println("@V@ Final Name of Files:- ["+fileNames[1]+"]");
/* 450 */ String retString = null; pstmt.close();
/* 451 */ String dataType = obj.getClass().getSimpleName(); rs.close();*/
/* 452 */ System.out.println("@V@ obj Format: " + dataType);
/* 453 */ if (obj.getClass().getSimpleName() == "Date") for(int i=1;i<=fileNameCount;i++)
/* */ { {
/* 455 */ // GenericUtility genericUtility = new GenericUtility();
/* */ try /*String sql = "select line_no,sql_expr,sql_input,sql_expr1,sql_expr2,sql_expr3,sql_expr4,"
/* */ { + " sql_expr5,sql_expr6 from tax_bal_grp_det where bal_group=? ";*/
/* 459 */ String dispalyDateFormat = genericUtility.getDispDateFormat(); String sql = "select sql_expr,sql_input,sql_expr1,sql_expr2,sql_expr3,sql_expr4,sql_expr5,sql_expr6 from TAX_BAL_GRP_DET where BAL_GROUP='SFARP' and to_number(LINE_NO)="+i+"" + // change SSCRP -> SSCRP1
/* 460 */ SimpleDateFormat sdf = new SimpleDateFormat(dispalyDateFormat); " order by to_number(line_no)";
/* 461 */ retString = sdf.format(obj); pstmt = conn.prepareStatement(sql);
/* */ } //pstmt.setString(1, "SFARP");
/* */ catch (ITMException e) rs = pstmt.executeQuery();
/* */ { if (rs.next())
/* 466 */ e.printStackTrace(); {
/* */ }
/* */ catch (Exception e) sqlExpr = checkNull(rs.getString("sql_expr"));
/* */ { sqlExpr1 = checkNull(rs.getString("sql_expr1"));
/* 471 */ e.printStackTrace(); sqlExpr2 = checkNull(rs.getString("sql_expr2"));
/* */ } sqlExpr3 = checkNull(rs.getString("sql_expr3"));
/* */ } sqlExpr4 = checkNull(rs.getString("sql_expr4"));
/* */ else sqlExpr5 = checkNull(rs.getString("sql_expr5"));
/* */ { sqlExpr6 = checkNull(rs.getString("sql_expr6"));
/* 476 */ retString = obj.toString(); objtNames = checkNull(rs.getString("sql_input"));
/* */ }
/* 478 */ return retString; compSql = sqlExpr + " " + sqlExpr1 + " " + sqlExpr2 + " " + sqlExpr3 + " " + sqlExpr4 + " " + sqlExpr5 + " "
/* */ } + sqlExpr6;
/* */ System.out.println("Combine SQL::::" + compSql);
/* */ public String schedulePriority(String arg0)
/* */ throws Exception System.out.println("inside execute dynamically Sql ");
/* */ { //processQuery(compSql,bl.get(i),al.get(i),conn);
/* 484 */ return null; processQuery(compSql,fileNames[i-1],conn);
/* */ } }
/* */ }
/* */ private String checkNull(String input)
/* */ { }
/* 489 */ if (input == null) { catch(Exception ee)
/* 490 */ input = ""; {
/* */ } System.out.println("@ Amit>> Error in [SFADailyReport.java]=>"+ee);
/* 492 */ return input.trim(); ee.printStackTrace();
/* */ }
/* */ }
/* */ public void printLogFile(String title, String msg, String fileName, Connection conn) finally
/* */ { {
/* 498 */ String logFile = ""; if(conn !=null && rs != null && pstmt1 !=null)
/* 499 */ String logDir = ""; {
/* 500 */ File logFileDir = null; conn.close();
/* 501 */ FileWriter fileWriter = null; rs.close();
/* 502 */ String currTime = null; pstmt.close();
/* 503 */ Calendar calendar = Calendar.getInstance(); }
/* 504 */ String filePath = "";
/* 505 */ E12GenericUtility genericUtility = new E12GenericUtility(); }
/* */ try return "";
/* */ { }
/* 508 */ SFAMonthlyReport sfa = new SFAMonthlyReport();
/* 509 */ String logFileName = ""; /*public void processQuery1(String query1,String fileName,String list,Connection conn)
/* */ {
/* 511 */ SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
/* 512 */ currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
/* 513 */ currTime = currTime.replaceAll("-", ""); PreparedStatement pstmt = null;
/* 514 */ calendar.setTime(new Timestamp(System.currentTimeMillis())); PrintWriter pw = null ;
/* 515 */ fileName = fileName + currTime + calendar.get(10) + calendar.get(12); PreparedStatement pstmt1 = null;
/* */ PreparedStatement pstmt2 = null;
/* 517 */ logFileName = fileName;
/* 518 */ DistCommon disCom = new DistCommon(); try
/* 519 */ filePath = sfa.getDisparamsServerLog("999999", "MONTHREPORT_LOG", conn); {
/* 520 */ System.out.println(" Sfa logFileName >> " + filePath); String currTime = null;
/* */ SimpleDateFormat sdf1=null;
/* 522 */ logDir = filePath; try {
/* 523 */ System.out.println("logDir >> " + logDir); sdf1 = new SimpleDateFormat(this.genericUtility.getDBDateFormat());
/* 524 */ logFileDir = new File(logDir); } catch (ITMException e) {
/* */ // TODO Auto-generated catch block
/* 526 */ if (!logFileDir.exists()) e.printStackTrace();
/* */ { } catch (Exception e) {
/* 528 */ logFileDir.mkdirs(); // TODO Auto-generated catch block
/* */ } e.printStackTrace();
/* */ }
/* 531 */ logFile = logDir + File.separator + logFileName + ".log"; currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
/* */ currTime = currTime.replaceAll("-", "");
/* 533 */ SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String logFileName = "SFA_Monthely_Report_" + currTime+"_";
/* 534 */ Date now = new Date(); System.out.println("@V@ Before Query1 Executed");
/* 535 */ String strDate = sdfDate.format(now); System.out.println("@V@ query1:- ["+query1+"]");
/* */ System.out.println("@Amit >> value of division:- ["+list+"]");
/* 537 */ fileWriter = new FileWriter(logFile, true); System.out.println("@V@ fileName:- ["+fileName+"]");
/* */ if(query2!=null)
/* 539 */ fileWriter.write("\r\n"); query1 = query1+" "+query2;
/* 540 */ fileWriter.write(strDate + " " + "INFO" + " " + "[" + title + "] : " + msg);
/* */ } int counter=0;
/* */ catch (Exception ex) System.out.println("Inside The Division Loop");
/* */ {
/* 544 */ ex.printStackTrace(); pstmt = conn.prepareStatement(query1);
/* */ try if(list!=null && list.length()>0)
/* */ { {
/* 552 */ if (fileWriter != null) pstmt.setString(1,list.trim());
/* */ { ResultSet rs = pstmt.executeQuery();
/* 554 */ fileWriter.flush(); System.out.println("@V@ Query Executed");
/* 555 */ fileWriter.close(); System.out.println("rs row==>"+rs.getRow());
/* */ } if (rs.next() )
/* */ } {
/* */ catch (Exception e)
/* */ {
/* 560 */ e.printStackTrace();
/* */ } if(row > 0){
/* */ } //Added for Get the path name from gencodes [start]
/* */ finally sql="SELECT FLD_NAME,MOD_NAME,FLD_VALUE,DESCR,SH_DESCR,UDF_STR1,UDF_STR2,UDF_STR3 FROM GENCODES WHERE ACTIVE='Y' AND FLD_NAME= ? ";
/* */ { pstmt2=conn.prepareStatement(sql);
/* */ try pstmt2.setString(1, "COMM_SITE_LIST");
/* */ { rs2=pstmt2.executeQuery();
/* 552 */ if (fileWriter != null) int count=0,commListNotFound=0;
/* */ { count=rs2.getRow();
/* 554 */ fileWriter.flush(); System.out.println("count"+count);
/* 555 */ fileWriter.close(); System.out.println("rs size"+rs2.getRow());
/* */ }
/* */ } while(rs2.next())
/* */ catch (Exception e) {
/* */ { commListNotFound++;
/* 560 */ e.printStackTrace(); fieldName=rs2.getString("FLD_NAME");
/* */ } System.out.println("@ Shri fieldName>> "+fieldName);
/* */ }
/* */ }
/* */ }
/* */ public String getUserInfo(String xtraParams) if(commListNotFound == 0)
/* */ throws ITMException {
/* */ { printLogFile("STDOUT", "Data Is Not found from Disparm Sql For TOTAL Sale For Site Code :: <" + siteCode,logFileName, conn);
/* 569 */ StringBuffer userInfoStr = new StringBuffer(); }
/* 570 */ String userId = ""; pstmt1.close();
/* 571 */ String loginEmpCode = ""; pstmt1=null;
/* 572 */ String loginSiteCode = ""; rs1.close();
/* 573 */ String entityCode = ""; rs1=null;
/* 574 */ String profileId = ""; //Added for Get the path name from gencodes [End]
/* 575 */ String userType = ""; fileName = fileName+"_"+(new SimpleDateFormat("ddMMyyyyhhmm").format(new Date()));
/* 576 */ String charEnc = ""; DistCommon disCom = new DistCommon();
/* 577 */ String chgTerm = ""; String jbossHome= disCom.getDisparams("999999", "MONTHLY_REPORT_", conn);
/* 578 */ String transDb = ""; System.out.println("jbossHome File Path >> "+ jbossHome);
/* 579 */ String sql = ""; //String jbossHome = CommonConstants.JBOSSHOME;
/* */ System.out.println("jbossHome>> " +jbossHome);
/* 581 */ PreparedStatement pstmt = null; File filDir=new File(jbossHome+"/"+"SFAMonthlyReport");
/* 582 */ ResultSet rs = null; File filDir=new File(jbossHome);
/* 583 */ Connection conn = null; if(!filDir.exists())
/* */ try {
/* */ { System.out.println("@V@ Folder not found In IF");
/* 586 */ //GenericUtility genericUtility = GenericUtility.getInstance(); filDir.mkdir();
/* 587 */ userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); }
/* 588 */ loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); else
/* 589 */ loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); {
/* 590 */ entityCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "entityCode"); System.out.println("@V@ Folder found In ELSE");
/* 591 */ profileId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "profileId"); }
/* 592 */ userType = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userType"); pw = new PrintWriter(jbossHome + File.separator
/* */ + "SFAMonthlyReport"+ File.separator + fileName +".csv");
/* 594 */ charEnc = CommonConstants.ENCODING; pw = new PrintWriter(jbossHome + File.separator + fileName +".csv");
/* 595 */ System.out.println("charEnc......" + charEnc); pw = new PrintWriter(jbossHome + File.separator
/* */ + "SFAMonthlyReport"+ File.separator + fileName +".csv");// vallabh change folder name.
/* 597 */ chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm"); System.out.println("pw >> " +pw.toString());
/* 598 */ UserInfoBean userInfo = new UserInfoBean(); rs.getMetaData().getColumnCount();
/* 599 */ DBAccessEJB dbAccessEJB = new DBAccessEJB(); ResultSetMetaData rsmd = rs.getMetaData();
/* 600 */ userInfo = dbAccessEJB.createUserInfo(userId); int columnsNumber = rsmd.getColumnCount();
/* 601 */ transDb = userInfo.getTransDB(); System.out.println("@V@ ColumnCount: " + columnsNumber);
/* 602 */ System.out.println("transDb::::@@@ " + transDb);
/* */ String sql = "select var_value from finparm where var_name='SSCDAILY_SEP'";
/* 604 */ userInfoStr.append("<UserInfo>"); pstmt1 = conn.prepareStatement(sql);
/* 605 */ userInfoStr.append("<loginCode>").append("<![CDATA[" + userId + "]]>").append("</loginCode>\r\n"); ResultSet rs2 = pstmt1.executeQuery();
/* 606 */ userInfoStr.append("<empCode>").append("<![CDATA[" + loginEmpCode + "]]>").append("</empCode>\r\n"); String seperator = ",";
/* 607 */ userInfoStr.append("<siteCode>").append("<![CDATA[" + loginSiteCode + "]]>").append("</siteCode>\r\n"); if(rs2.next())
/* 608 */ userInfoStr.append("<entityCode>").append("<![CDATA[" + entityCode + "]]>").append("</entityCode>\r\n"); {
/* 609 */ userInfoStr.append("<profileId>").append("<![CDATA[" + profileId + "]]>").append("</profileId>\r\n"); seperator = rs2.getString("var_value");
/* 610 */ userInfoStr.append("<userType>").append("<![CDATA[" + userType + "]]>").append("</userType>\r\n"); }
/* 611 */ userInfoStr.append("<charEnc>").append("<![CDATA[" + charEnc + "]]>").append("</charEnc>\r\n");
/* 612 */ userInfoStr.append("<remoteHost>").append("<![CDATA[" + chgTerm + "]]>").append("</remoteHost>\r\n");
/* 613 */ userInfoStr.append("<transDB>").append("<![CDATA[" + transDb + "]]>").append("</transDB>\r\n"); StringBuilder sb1 = new StringBuilder();
/* */ for (int i = 1; i <= columnsNumber; i++)
/* 615 */ userInfoStr.append("</UserInfo>"); {
/* */ } System.out.println("Inside the columnsNumber loop ");
/* */ catch (Exception e) sb1.append(" "+rsmd.getColumnName(i) + ""+seperator.trim()+" ");
/* */ { // sb1.append(""+rsmd.getColumnName(i) + ""+seperator.trim()+" ");
/* 619 */ throw new ITMException(e); }
/* */ } pw.println(sb1.substring(0, sb1.length() - 1));
/* 621 */ return userInfoStr.toString(); System.out.println("rs row==>"+rs.getRow());
/* */ } if (rs.next() )
/* */ {
/* */ public String getDisparamsServerLog(String prdCode, String varName, Connection conn) System.out.println("Inside the rs");
/* */ {
/* 655 */ String retVal = null; } else{
/* 656 */ String sql = null; System.out.println("Inside the close rs");
/* 657 */ ResultSet rs = null; }
/* 658 */ Statement stmt = null;
/* */ try { while (rs.next())
/* 660 */ System.out {
/* 661 */ .println("Finding the variable value from Disparam for parameters[" + System.out.println("Inside the while");
/* 662 */ prdCode + "," + varName + "]"); StringBuilder sb = new StringBuilder();
/* 663 */ stmt = conn.createStatement(); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++)
/* 664 */ sql = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE ='" + prdCode + {
/* 665 */ "' AND VAR_NAME ='" + varName + "'"; for (int i = 1; i <= columnsNumber; i++)
/* 666 */ rs = stmt.executeQuery(sql); {
/* 667 */ if (rs.next()) Object obj = rs.getObject(i);
/* 668 */ retVal = rs.getString(1) == null ? " " : rs.getString(1); String str = "" + rs.getString(i);
/* */ else { System.out.println("str>> "+str);
/* 670 */ retVal = "NULLFOUND"; if(obj!=null)
/* */ } str = changeType(obj);
/* 672 */ rs.close(); //System.out.println("Data: " + str);
/* 673 */ stmt.close(); str = str.replaceAll("\n", " ");
/* 674 */ rs = null; str = str.replaceAll("\r", " ");
/* 675 */ stmt = null; str = str.replaceAll("\t", " ");
/* */ } catch (Exception e) { //sb.append(" "+str.trim() + ""+seperator.trim()+"");
/* 677 */ e.printStackTrace(); sb.append(str.trim()+seperator.trim());
/* */ } }
/* 679 */ return retVal; //String csvLine = sb.toString();
/* */ } System.out.println("@V@ StringBuider: "+sb);
/* */ // print to csv file after removing the trailing ',' character
/* */ public void processQuery(String query1, String fileName, Connection conn) pw.println(sb.substring(0, sb.length() - 1));
/* */ { }
/* 685 */ PreparedStatement pstmt = null;
/* 686 */ PrintWriter pw = null; for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++)
/* */ {
/* 688 */ PreparedStatement pstmt1 = null; System.out.println("Inside the columnsNumber loop ");
/* 689 */ String currTime = null; sb1.append(" "+rs.getMetaData().getColumnName(i) + ""+seperator.trim()+" ");
/* 690 */ SimpleDateFormat sdf1 = null; // sb1.append(""+rsmd.getColumnName(i) + ""+seperator.trim()+" ");
/* */ try }
/* */ { pw.println(sb1.substring(0, sb1.length() - 1));
/* */ try System.out.println("@V@ File Generated");
/* */ { pw.flush();
/* 695 */ sdf1 = new SimpleDateFormat(this.genericUtility.getDBDateFormat()); pw.close();
/* */ } SFACSVToExcelConverter csv = new SFACSVToExcelConverter();
/* */ catch (ITMException e) { System.out.println("@V@ file name before EXCEL conversion :- ["+fileName+"]");
/* 698 */ e.printStackTrace(); csv.convertMonthlyReport(fileName,seperator.trim(),conn);
/* */ } printLogFile("STDOUT", "File Has Been Generated For Division :: <" +list+">",logFileName, conn);
/* */ catch (Exception e) { //csv.convertCsvToXls(fileName,seperator.trim());
/* 701 */ e.printStackTrace(); }else{
/* */ } printLogFile("STDOUT", "File Not Generated Because Division Data Not Found For :: <" +list+">",logFileName, conn);
/* */ }
/* 704 */ System.out.println("@V@ Before Query1 Executed");
/* 705 */ System.out.println("@V@ query1:- [" + query1 + "]");
/* 706 */ System.out.println("@V@ fileName:- [" + fileName + "]"); } else{
/* */
/* 711 */ currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
/* 712 */ currTime = currTime.replaceAll("-", ""); System.out.println("no data");
/* 713 */ String logFileName = "SFA_Monthely_Report_" + currTime + "_"; printLogFile("STDOUT", "File Not Generated Because Division Data Is Not Found For division :: <" +list+">",logFileName, conn);
/* 714 */ pstmt = conn.prepareStatement(query1);
/* */
/* 718 */ ResultSet rs = pstmt.executeQuery(); }
/* 719 */ System.out.println("@V@ Query Executed"); }
/* 720 */ System.out.println("rs row==>" + rs.getRow()); else{
/* 721 */ System.out.println("@V@ Query Executed"); printLogFile("STDOUT", "File Not Generated Because Division Not Found For :: <" +list+">",logFileName, conn);
/* */ }
/* 726 */ fileName = fileName + "_" + new SimpleDateFormat("ddMMyyyyhhmm").format(new Date()); }
/* 727 */ DistCommon disCom = new DistCommon(); catch (SQLException e)
/* 728 */ String jbossHome = disCom.getDisparams("999999", "MONTHLY_REPORT_", conn); {
/* 729 */ System.out.println("jbossHome File Path >> " + jbossHome); e.printStackTrace();
/* 730 */ File filDir = new File(jbossHome); }
/* 731 */ if (!filDir.exists()) catch (FileNotFoundException e)
/* */ { {
/* 733 */ System.out.println("@V@ Folder not found In IF"); // TODO Auto-generated catch block
/* 734 */ filDir.mkdir(); e.printStackTrace();
/* */ } }
/* */ else catch (IOException e)
/* */ { {
/* 738 */ System.out.println("@V@ Folder found In ELSE"); // TODO Auto-generated catch block
/* */ } e.printStackTrace();
/* */ }
/* 742 */ pw = new PrintWriter(jbossHome + File.separator + fileName + ".csv"); finally
/* 743 */ ResultSetMetaData rsmd = rs.getMetaData(); {
/* 744 */ int columnsNumber = rsmd.getColumnCount(); try
/* 745 */ System.out.println("@V@ ColumnCount: " + columnsNumber); {
/* */ if(pw!=null && pstmt!=null)
/* 747 */ String sql = "select var_value from finparm where var_name='SSCDAILY_SEP'"; {
/* 748 */ pstmt1 = conn.prepareStatement(sql); pw.flush();
/* 749 */ ResultSet rs2 = pstmt1.executeQuery(); pw.close();
/* 750 */ String seperator = ","; pstmt.close();
/* 751 */ if (rs2.next()) }
/* */ { }
/* 753 */ seperator = rs2.getString("var_value"); catch (SQLException e)
/* */ } {
/* */ // TODO Auto-generated catch block
/* 757 */ StringBuilder sb1 = new StringBuilder(); e.printStackTrace();
/* 758 */ for (int i = 1; i <= columnsNumber; i++) }
/* */ { }
/* 760 */ sb1.append("\t" + rsmd.getColumnName(i) + seperator.trim() + "\t");
/* */ } }*/
/* */
/* 763 */ pw.println(sb1.substring(0, sb1.length() - 1)); String changeType(Object obj)
/* */ {
/* 766 */ while (rs.next()) String retString = null;
/* */ { String dataType = obj.getClass().getSimpleName();
/* 769 */ StringBuilder sb = new StringBuilder(); System.out.println("@V@ obj Format: "+dataType);
/* 770 */ for (int i = 1; i <= columnsNumber; i++) if((obj.getClass().getSimpleName())=="Date")
/* */ { {
/* 773 */ String str = rs.getString(i); E12GenericUtility genericUtility= new E12GenericUtility();
/* */ String dispalyDateFormat;
/* 777 */ str = str.replaceAll("\n", " "); try
/* 778 */ str = str.replaceAll("\r", " "); {
/* 779 */ str = str.replaceAll("\t", " "); dispalyDateFormat = genericUtility.getDispDateFormat();
/* */ SimpleDateFormat sdf = new SimpleDateFormat(dispalyDateFormat);
/* 781 */ sb.append(str.trim() + seperator.trim()); retString = sdf.format(obj);
/* */ } }
/* */ catch (ITMException e)
/* 784 */ System.out.println("@V@ StringBuider: " + sb); {
/* */ // TODO Auto-generated catch block
/* 786 */ pw.println(sb.substring(0, sb.length() - 1)); e.printStackTrace();
/* */ } }
/* 788 */ System.out.println("@V@ File Generated"); catch (Exception e)
/* 789 */ pw.flush(); {
/* 790 */ pw.close(); // TODO Auto-generated catch block
/* 791 */ SFACSVToExcelConverter csv = new SFACSVToExcelConverter(); e.printStackTrace();
/* 792 */ System.out.println("@V@ file name before EXCEL conversion :- [" + fileName + "]"); }
/* */ }
/* 794 */ csv.convertMonthlyReport(fileName, seperator.trim(), logFileName, conn); else
/* */ {
/* 797 */ printLogFile("STDOUT", "File Not Generated Because Division Not Found For :: <" + fileName + ">", logFileName, conn); retString = obj.toString();
/* */ } }
/* */ catch (SQLException e) return retString;
/* */ { }
/* 802 */ e.printStackTrace(); @Override
/* */ try public String schedulePriority(String arg0) throws Exception
/* */ { {
/* 818 */ pw.flush(); // TODO Auto-generated method stub
/* 819 */ pw.close(); return null;
/* 820 */ pstmt.close(); }
/* */ }
/* */ catch (SQLException e1)
/* */ { private String checkNull(String input) {
/* 825 */ e1.printStackTrace(); if (input == null) {
/* */ } input = "";
/* */ } }
/* */ catch (FileNotFoundException e) return input.trim();
/* */ { }
/* 807 */ e.printStackTrace();
/* */ try public void printLogFile(String title, String msg, String fileName,Connection conn)
/* */ { {
/* 818 */ pw.flush();
/* 819 */ pw.close(); String logFile = "";
/* 820 */ pstmt.close(); String logDir = "";
/* */ } File logFileDir = null;
/* */ catch (SQLException e1) FileWriter fileWriter = null;
/* */ { String currTime = null;
/* 825 */ e1.printStackTrace(); Calendar calendar = Calendar.getInstance();
/* */ } String filePath = "";
/* */ } E12GenericUtility genericUtility = new E12GenericUtility();
/* */ catch (IOException e) try
/* */ { {
/* 812 */ e.printStackTrace(); SFAMonthlyReport sfa =new SFAMonthlyReport();
/* */ try String logFileName = "";
/* */ { //SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
/* 818 */ pw.flush(); SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
/* 819 */ pw.close(); currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
/* 820 */ pstmt.close(); currTime = currTime.replaceAll("-","");
/* */ } calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
/* */ catch (SQLException e1) fileName = fileName+currTime+calendar.get(Calendar.HOUR)+""+calendar.get(Calendar.MINUTE);
/* */ {
/* 825 */ e1.printStackTrace(); logFileName = fileName;
/* */ } DistCommon disCom = new DistCommon();
/* */ } filePath= sfa.getDisparamsServerLog("999999", "MONTHREPORT_LOG", conn);
/* */ finally System.out.println(" Sfa logFileName >> "+ filePath);
/* */ { /*logDir = CommonConstants.JBOSSHOME + File.separator + "AMDPO" + File.separator + "Stock Transfer Scheduler-To-Track-Exceptions";*/
/* */ try logDir= filePath;
/* */ { System.out.println("logDir >> "+logDir);
/* 818 */ pw.flush(); logFileDir = new File(logDir);
/* 819 */ pw.close();
/* 820 */ pstmt.close(); if (!logFileDir.exists())
/* */ } {
/* */ catch (SQLException e) logFileDir.mkdirs();
/* */ { }
/* 825 */ e.printStackTrace();
/* */ } logFile = logDir + File.separator + logFileName + ".log";
/* */ } //SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
/* */ } SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm");
/* */ } java.util.Date now = new java.util.Date();
String strDate = sdfDate.format(now);
/* Location: C:\Users\pravin.nevage\Desktop\ibase3-webitm-sc2-0-1-5.jar
* Qualified Name: ibase.webitm.ejb.sc.SFAMonthlyReport fileWriter = new FileWriter(logFile, true);
* JD-Core Version: 0.6.0
fileWriter.write("\r\n");
fileWriter.write(strDate + " " + "INFO" + " " + "["+ title +"] : " + msg);
}
catch (Exception ex)
{
ex.printStackTrace();
//printLog("STDERR", ex, "");
//printLog("STDOUT","Inside Exception [getLog]>>" + ex.toString(),fileName);
}
finally
{
try
{
if (fileWriter != null)
{
fileWriter.flush();
fileWriter.close();
}
}
catch (Exception e)
{
e.printStackTrace();
//printLog("STDERR", e,fileName);
}
}
}
public String getUserInfo(String xtraParams) throws ITMException
{
StringBuffer userInfoStr = new StringBuffer();
String userId = "";
String loginEmpCode = "";
String loginSiteCode = "";
String entityCode = "";
String profileId = "";
String userType = "";
String charEnc = "";
String chgTerm = "";
String transDb = "";
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
try
{
E12GenericUtility genericUtility= new E12GenericUtility();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
entityCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "entityCode");
profileId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "profileId");
userType = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userType");
charEnc = CommonConstants.ENCODING;
System.out.println("charEnc......" + charEnc);
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
UserInfoBean userInfo = new UserInfoBean();
DBAccessEJB dbAccessEJB = new DBAccessEJB();
userInfo = dbAccessEJB.createUserInfo(userId);
transDb = userInfo.getTransDB();
System.out.println("transDb::::@@@ " + transDb);
userInfoStr.append("<UserInfo>");
userInfoStr.append("<loginCode>").append("<![CDATA[" + userId + "]]>").append("</loginCode>\r\n");
userInfoStr.append("<empCode>").append("<![CDATA[" + loginEmpCode + "]]>").append("</empCode>\r\n");
userInfoStr.append("<siteCode>").append("<![CDATA[" + loginSiteCode + "]]>").append("</siteCode>\r\n");
userInfoStr.append("<entityCode>").append("<![CDATA[" + entityCode + "]]>").append("</entityCode>\r\n");
userInfoStr.append("<profileId>").append("<![CDATA[" + profileId + "]]>").append("</profileId>\r\n");
userInfoStr.append("<userType>").append("<![CDATA[" + userType + "]]>").append("</userType>\r\n");
userInfoStr.append("<charEnc>").append("<![CDATA[" + charEnc + "]]>").append("</charEnc>\r\n");
userInfoStr.append("<remoteHost>").append("<![CDATA[" + chgTerm + "]]>").append("</remoteHost>\r\n");
userInfoStr.append("<transDB>").append("<![CDATA[" + transDb + "]]>").append("</transDB>\r\n");
userInfoStr.append("</UserInfo>");
}
catch (Exception e)
{
throw new ITMException(e);
}
return userInfoStr.toString();
}
/*public String getDisparams(String prdCode, String varName, Connection conn) {
String retVal = null;
String sql = null;
ResultSet rs = null;
Statement stmt = null;
try {
System.out
.println("Finding the variable value from Disparam for parameters["
+ prdCode + "," + varName + "]");
stmt = conn.createStatement();
sql = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE ='" + prdCode
+ "' AND VAR_NAME ='" + varName + "'";
rs = stmt.executeQuery(sql);
if (rs.next()) {
retVal = (rs.getString(1) == null ? " " : rs.getString(1));
} else {
retVal = "NULLFOUND";
}
rs.close();
stmt.close();
rs = null;
stmt = null;
} catch (Exception e) {
e.printStackTrace();
}
return (retVal);
}*/
public String getDisparamsServerLog(String prdCode, String varName, Connection conn) {
String retVal = null;
String sql = null;
ResultSet rs = null;
Statement stmt = null;
try {
System.out
.println("Finding the variable value from Disparam for parameters["
+ prdCode + "," + varName + "]");
stmt = conn.createStatement();
sql = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE ='" + prdCode
+ "' AND VAR_NAME ='" + varName + "'";
rs = stmt.executeQuery(sql);
if (rs.next()) {
retVal = (rs.getString(1) == null ? " " : rs.getString(1));
} else {
retVal = "NULLFOUND";
}
rs.close();
stmt.close();
rs = null;
stmt = null;
} catch (Exception e) {
e.printStackTrace();
}
return (retVal);
}
public void processQuery(String query1,String fileName,Connection conn)
{
PreparedStatement pstmt = null;
PrintWriter pw = null ;
PreparedStatement pstmt1 = null;
String currTime = null;
SimpleDateFormat sdf1=null;
try
{
try {
sdf1 = new SimpleDateFormat(this.genericUtility.getDBDateFormat());
} catch (ITMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//System.out.println("list >> " +list);
System.out.println("@V@ Before Query1 Executed");
System.out.println("@V@ query1:- ["+query1+"]");
System.out.println("@V@ fileName:- ["+fileName+"]");
/* if(query2!=null)
query1 = query1+" "+query2;
*/ */
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
currTime = currTime.replaceAll("-", "");
String logFileName = "SFA_Monthely_Report_" + currTime+"_";
pstmt = conn.prepareStatement(query1);
/*if(list!=null && list.length()>0)
{
pstmt.setString(1,list.trim());*/
ResultSet rs = pstmt.executeQuery();
System.out.println("@V@ Query Executed");
System.out.println("rs row==>"+rs.getRow());
System.out.println("@V@ Query Executed");
//fileName = fileName+"_"+(new SimpleDateFormat("ddMMyyyyhhmm").format(new Date()));
//String jbossHome = CommonConstants.JBOSSHOME;
fileName = fileName+"_"+(new SimpleDateFormat("ddMMyyyyhhmm").format(new Date()));
DistCommon disCom = new DistCommon();
String jbossHome= disCom.getDisparams("999999", "MONTHLY_REPORT_", conn);
System.out.println("jbossHome File Path >> "+ jbossHome);
File filDir=new File(jbossHome);
if(!filDir.exists())
{
System.out.println("@V@ Folder not found In IF");
filDir.mkdir();
}
else
{
System.out.println("@V@ Folder found In ELSE");
}
/*pw = new PrintWriter(jbossHome + File.separator
+ "SSCMonthlyReport"+ File.separator + fileName +".csv");*/// vallabh change folder name.
pw = new PrintWriter(jbossHome + File.separator + fileName +".csv");
ResultSetMetaData rsmd = rs.getMetaData();
int columnsNumber = rsmd.getColumnCount();
System.out.println("@V@ ColumnCount: " + columnsNumber);
String sql = "select var_value from finparm where var_name='SSCDAILY_SEP'";
pstmt1 = conn.prepareStatement(sql);
ResultSet rs2 = pstmt1.executeQuery();
String seperator = ",";
if(rs2.next())
{
seperator = rs2.getString("var_value");
}
StringBuilder sb1 = new StringBuilder();
for (int i = 1; i <= columnsNumber; i++)
{
sb1.append(" "+rsmd.getColumnName(i) + ""+seperator.trim()+" ");
// sb1.append(""+rsmd.getColumnName(i) + ""+seperator.trim()+" ");
}
pw.println(sb1.substring(0, sb1.length() - 1));
while (rs.next())
{
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= columnsNumber; i++)
{
/*Object obj = rs.getObject(i);*/
String str = "" + rs.getString(i);
/*if(obj!=null)
str = changeType(obj);*/
//System.out.println("Data: " + str);
str = str.replaceAll("\n", " ");
str = str.replaceAll("\r", " ");
str = str.replaceAll("\t", " ");
//sb.append(" "+str.trim() + ""+seperator.trim()+"");
sb.append(str.trim()+seperator.trim());
}
//String csvLine = sb.toString();
System.out.println("@V@ StringBuider: "+sb);
// print to csv file after removing the trailing ',' character
pw.println(sb.substring(0, sb.length() - 1));
}
System.out.println("@V@ File Generated");
pw.flush();
pw.close();
SFACSVToExcelConverter csv = new SFACSVToExcelConverter();
System.out.println("@V@ file name before EXCEL conversion :- ["+fileName+"]");
//csv.convertMonthlyReport(fileName,seperator.trim(),list,conn);
csv.convertMonthlyReport(fileName,seperator.trim(),logFileName,conn);
printLogFile("STDOUT", "File Not Generated Because Division Not Found For :: <" +fileName+">",logFileName, conn);
}
catch (SQLException e)
{
e.printStackTrace();
}
catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
try
{
pw.flush();
pw.close();
pstmt.close();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment