Commit 21141f16 authored by ssalve's avatar ssalve

done changes for reg_date and removed valid_upto


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106037 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f059d902
...@@ -56,14 +56,13 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -56,14 +56,13 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
{ {
System.out.println("Inside GSTRegNoPosEJB Post Save ["+xmlstring+"] \n xtraParams ["+xtraParams+"] \n forcedFlag["+forcedFlag+"]"); System.out.println("Inside GSTRegNoPosEJB Post Save ["+xmlstring+"] \n xtraParams ["+xtraParams+"] \n forcedFlag["+forcedFlag+"]");
String finEntity="",finDescr="",siteCode="",siteDescr="",regNo="",regNo1="",regNo2=""; String finEntity="",finDescr="",siteCode="",siteDescr="",regNo="",regNo1="",regNo2="";
String validUpto=null; String regDate=null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
Timestamp currDate = null; Timestamp currDate = null;
Timestamp validUptoDate = null; Timestamp validUptoDate = null;
boolean isError = false,isLocCon = false; boolean isError = false,isLocCon = false;
Document dom = null; Document dom = null;
String sql = "",retString = "",tranID = "", tranIdGSTN = ""; String sql = "",retString = "",tranID = "", tranIdGSTN = "";
String gstInNo = "GSTIN_NO"; String gstInNo = "GSTIN_NO";
String gstUserName = "GST_UNAME"; String gstUserName = "GST_UNAME";
...@@ -73,7 +72,7 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -73,7 +72,7 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
String loginSite = ""; String loginSite = "";
java.sql.Date chg_date=null; java.sql.Date chg_date=null;
String val = ""; String val = "";
String loginSiteCode = "";
try try
{ {
if(conn == null || conn.isClosed()) if(conn == null || conn.isClosed())
...@@ -101,20 +100,19 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -101,20 +100,19 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
NodeList detail1NodeList =dom.getElementsByTagName("Detail1"); NodeList detail1NodeList =dom.getElementsByTagName("Detail1");
int detail3NodeListlen = detail1NodeList.getLength(); int detail3NodeListlen = detail1NodeList.getLength();
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("loginSite>>>>>>>>>>"+loginSite); System.out.println("loginSite>>>>>>>>>>"+loginSite);
for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++) for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++)
{ {
NodeList childNodeList = detail1NodeList.item(ctrH).getChildNodes(); NodeList childNodeList = detail1NodeList.item(ctrH).getChildNodes();
int childNodeListlen = childNodeList.getLength(); int childNodeListlen = childNodeList.getLength();
System.out.println("childNodeListlen>>>>>"+childNodeListlen); System.out.println("childNodeListlen>>>>>"+childNodeListlen);
for(int ctrD = 0; ctrD < childNodeListlen ; ctrD++) for(int ctrD = 0; ctrD < childNodeListlen ; ctrD++)
{ {
Node childNode = childNodeList.item(ctrD); Node childNode = childNodeList.item(ctrD);
System.out.println("childNode.getNodeName()>>"+childNode.getNodeName());
if(childNode != null && "fin_entity".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null) if(childNode != null && "fin_entity".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{ {
finEntity = checkNullAndTrim(childNode.getFirstChild().getNodeValue()); finEntity = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
...@@ -143,16 +141,20 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -143,16 +141,20 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
{ {
regNo2 = checkNullAndTrim(childNode.getFirstChild().getNodeValue()); regNo2 = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
} }
else if(childNode != null && "valid_upto".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null) else if(childNode != null && "reg_date".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{ {
validUpto = checkNullAndTrim(childNode.getFirstChild().getNodeValue()); regDate = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
} }
} }
} }
System.out.println("finEntity["+finEntity+"]"+"finDescr["+finDescr+"]"+"siteCode["+siteCode+"]"+"siteDescr["+siteDescr+"]"+"regNo["+regNo+"]"+"regNo1["+regNo1+"]"+"regNo2["+regNo2+"]"+"validUpto["+validUpto+"]"); System.out.println("finEntity["+finEntity+"]"+"finDescr["+finDescr+"]"+"siteCode["+siteCode+"]"+"siteDescr["+siteDescr+"]"+"regNo["+regNo+"]"+"regNo1["+regNo1+"]"+"regNo2["+regNo2+"]"+"regDate["+regDate+"]");
validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(validUpto, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(regDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("validUptoDate["+validUptoDate+"]"); System.out.println("validUptoDate["+validUptoDate+"]");
ArrayList refList = new ArrayList();
refList.add("GSTIN_NO");
refList.add("GST_UNAME");
refList.add("GST_GT");
ArrayList gstList = new ArrayList(); ArrayList gstList = new ArrayList();
gstList.add(regNo); gstList.add(regNo);
...@@ -164,29 +166,36 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -164,29 +166,36 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
map.put(regNo1, "GST_UNAME"); map.put(regNo1, "GST_UNAME");
map.put(regNo2, "GST_GT"); map.put(regNo2, "GST_GT");
sql = "select count(*) as cnt from siteregno where fin_entity=? AND site_code=? AND ref_code=?";
sql = "select count(*) as cnt from siteregno where fin_entity=? AND site_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,finEntity);
pstmt.setString(2,siteCode); for(int i=0;i<refList.size();i++)
rs = pstmt.executeQuery(); {
String refCode = (String)refList.get(i);
System.out.println("refCode::::"+refCode);
pstmt.setString(1,finEntity);
pstmt.setString(2,siteCode);
pstmt.setString(3,refCode.trim());
rs = pstmt.executeQuery();
}
if(rs.next()) if(rs.next())
{ {
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
System.out.println("cnt>>>>>>>"+cnt);
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(cnt>0) if(cnt>0)
{ {
sql = "update siteregno set reg_no=?, valid_upto=? where fin_entity=? AND site_code=? AND ref_code=?"; sql = "update siteregno set reg_no=?,reg_date=? where fin_entity=? AND site_code=? AND ref_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
for(int x =0 ; x< gstList.size(); x++) for(int x =0 ; x< gstList.size(); x++)
{ {
...@@ -201,35 +210,37 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -201,35 +210,37 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
else else
{ {
sql = " insert into siteregno (fin_entity,site_code,ref_code,reg_no,valid_upto,chg_date,chg_user,eff_from) values(?,?,?,?,?,?,?,?)"; sql = " insert into siteregno (fin_entity,site_code,ref_code,reg_no,valid_upto,reg_date,chg_date,chg_user,eff_from) values(?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
for(int y =0 ; y< gstList.size(); y++)
{ for(int y =0 ; y< gstList.size(); y++)
gstRefCode = (String) gstList.get(y); {
val = (String) map.get(gstRefCode); gstRefCode = (String) gstList.get(y);
pstmt.setString(1,finEntity); val = (String) map.get(gstRefCode);
pstmt.setString(2,siteCode); pstmt.setString(1,finEntity);
pstmt.setString(3,val); pstmt.setString(2,siteCode);
pstmt.setString(4, gstRefCode); pstmt.setString(3,val);
pstmt.setTimestamp(5,validUptoDate); pstmt.setString(4, gstRefCode);
pstmt.setTimestamp(6,currDate); pstmt.setTimestamp(5,currDate);
pstmt.setString(7,loginSite); pstmt.setTimestamp(6,validUptoDate);
pstmt.setTimestamp(8,currDate); pstmt.setTimestamp(7,currDate);
pstmt.addBatch(); pstmt.setString(8,loginSite);
} pstmt.setTimestamp(9,currDate);
pstmt.executeBatch(); pstmt.addBatch();
if(pstmt != null) }
{ pstmt.executeBatch();
pstmt.close(); if(pstmt != null)
pstmt = null; {
} pstmt.close();
} pstmt = null;
}
}
}//End if Detail1 not found }//End if Detail1 not found
else else
{ {
...@@ -237,7 +248,7 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -237,7 +248,7 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn); retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn);
return retString; return retString;
} }
} }// end of try block
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception GSTRegNoPosEJB ==>"+e.getMessage()); System.out.println("Exception GSTRegNoPosEJB ==>"+e.getMessage());
......
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