Commit 33736489 authored by steurwadkar's avatar steurwadkar

F17ABAS001 source code commit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106408 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 63ddcd0f
......@@ -216,9 +216,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
StringBuffer valueXmlString = new StringBuffer();
int currentFormNo = 0;
String sql = "", siteCode = "", siteDescr = "", gstinNo = "", userName = "", stateCode = "", stateDescr = "", grossTurnover = "", periodCode = "", currDateStr = "", currentYearGrossTurnover = "";
String tokenStr = "";
Calendar calendar = new GregorianCalendar();
String sql = "", siteCode = "", siteDescr = "", gstinNo = "", userName = "", stateCode = "", stateDescr = "", grossTurnover = "", periodCode = "", currentYearGrossTurnover = "";
String tokenStr = "", authTokenDB = "", sekDB = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -247,6 +246,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
appKey = aesEncryption.generateSecureKey();
//appKey = "POpmbksVORVw+lYamRvxlq8zG7yushjFE3+RcZrx7b0=";
appKeyInBytes = aesEncryption.decodeBase64StringTOByte(appKey);
appKeyEncryptedAndCoded = pubKeyEncryption.encrypt(appKeyInBytes);
......@@ -290,10 +290,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
pstmt = null;
}
calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -1);
sql ="SELECT RESPONSE_INFO FROM API_CALL_LOG WHERE CALL_TYPE='AUTHTOKEN' AND CALL_STATUS = '1' AND SITE_CODE = ? ORDER BY CALL_DATE DESC";
/*sql ="SELECT RESPONSE_INFO FROM API_CALL_LOG WHERE CALL_TYPE='AUTHTOKEN' AND CALL_STATUS = '1' AND SITE_CODE = ? ORDER BY CALL_DATE DESC";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
......@@ -314,31 +311,17 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
pstmt = null;
}
/*SimpleDateFormat sdf = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
currDateStr = sdf.format(calendar.getTime());
System.out.println("currDateStr["+currDateStr+"]");
sql = "SELECT TO_CHAR(TO_DATE(CODE,'yyyymm'),'mmyyyy') AS CODE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currDateStr);
rs = pstmt.executeQuery();
if(rs.next())
if(tokenStr.split(":").length > 0)
{
periodCode = rs.getString("CODE");
authTokenDB = tokenStr.split(":")[0];
sekDB = tokenStr.split(":")[1];
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if(authTokenDB!=null && authTokenDB.trim().length()>0 && sekDB!=null && sekDB.trim().length()>0)
{
pstmt.close();
pstmt = null;
System.out.println("560101.authtoken and sek found database");
System.out.println("560101.authTokenDB["+authTokenDB+"]");
System.out.println("560101.sekDB["+sekDB+"]");
}*/
valueXmlString.append("<Detail1 domID='1'>");
......@@ -353,6 +336,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
valueXmlString.append("<cur_gross_turnover><![CDATA[").append(currentYearGrossTurnover).append( "]]></cur_gross_turnover>");
valueXmlString.append("<otp><![CDATA[]]></otp>");
valueXmlString.append("<app_key><![CDATA["+appKey+"]]></app_key>");
/*valueXmlString.append("<auth_token><![CDATA["+authTokenDB+"]]></auth_token>");
valueXmlString.append("<sek><![CDATA["+sekDB+"]]></sek>");*/
valueXmlString.append("</Detail1>" );
}
break;
......@@ -379,6 +364,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
returnType = checkNull(e12GenericUtility.getColumnValue("returns_type", dom1));
action = checkNull(e12GenericUtility.getColumnValue("action", dom1));
siteCode = checkNull(e12GenericUtility.getColumnValue("site_code", dom1));
/*authToken = checkNull(e12GenericUtility.getColumnValue("auth_token", dom1));
sek = checkNull(e12GenericUtility.getColumnValue("sek", dom1));*/
if("GSTR1".equalsIgnoreCase(returnType.trim()))
{
......@@ -516,7 +503,6 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
callStatus = "1";
authToken = object.getString("auth_token");
sek = object.getString("sek");
responseJsonStr = authToken+":"+sek; //TODO temperary insert need to change
authSEK = aesEncryption.decrypt(sek, appKeyInBytes);
System.out.println("AuthSEK = "+ aesEncryption.encodeBase64String(authSEK));
......
......@@ -234,7 +234,12 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
String loginCode = "", chgTerm = "", callStatus = "", responseId = "", responseJsonStr= "";
byte[] authSEK = null;
String sql = "", tokenStr = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
APICallData apiCallData = null;
boolean isDataLogged = false;
try
{
......@@ -358,6 +363,40 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
appKeyInBytes = aesEncryption.decodeBase64StringTOByte(appKey);
appKeyEncryptedAndCoded = pubKeyEncryption.encrypt(appKeyInBytes);
/*sql ="SELECT RESPONSE_INFO FROM API_CALL_LOG WHERE CALL_TYPE='AUTHTOKEN' AND CALL_STATUS = '1' AND SITE_CODE = ? ORDER BY CALL_DATE DESC";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
tokenStr = checkNullandTrim((rs.getString("RESPONSE_INFO")));
System.out.println("560101.inside if auth token found in table["+tokenStr+"]");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(tokenStr.split(":").length > 0)
{
authToken = tokenStr.split(":")[0];
sek = tokenStr.split(":")[1];
}
if(authToken!=null && authToken.trim().length()>0 && sek!=null && sek.trim().length()>0)
{
System.out.println("560101.authtoken and sek found database");
System.out.println("560101.authTokenDB["+authToken+"]");
System.out.println("560101.sekDB["+sek+"]");
}*/
if(authToken.trim().length() > 0 && sek.trim().length() > 0)
{
System.out.println("authToken and authSEK from detail2");
......@@ -423,7 +462,6 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
System.out.println("AuthSEK = "+ aesEncryption.encodeBase64String(authSEK));
callStatus = "1";
responseJsonStr = authToken+":"+sek;//TODO temperary insert need to change
apiCallData.setCallStatus(callStatus);
apiCallData.setResponseId(responseId);
apiCallData.setResponseJsonStr(responseJsonStr);
......@@ -479,6 +517,9 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
apiCallData.setResponseJsonStr(responseJsonStr);
return retString;
}
gstCommonUtil.updateAPICallLogHistory(apiCallData, null);
isDataLogged = true;
}
if(authToken != null && authToken.trim().length() > 0 && authSEK != null)
......@@ -522,7 +563,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
finally
{
if(apiCallData != null)
if(apiCallData != null && !isDataLogged)
{
gstCommonUtil.updateAPICallLogHistory(apiCallData, null);
}
......
......@@ -12,7 +12,8 @@ import ibase.webitm.bean.gst.Invoice;
abstract class BaseSerializer<T extends BaseData> extends JsonSerializer<T>
{
final SimpleDateFormat gstFmt = new SimpleDateFormat("dd-MM-yyyy");
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
final SimpleDateFormat gstFmt = new SimpleDateFormat(gstCommonUtil.getGSTDateFormat());
void writeInvoices(T genericInvoice, JsonGenerator json) throws IOException
{
......
......@@ -13,7 +13,9 @@ import ibase.webitm.bean.gst.CDNRA;
public class CDNRASerializer extends JsonSerializer<CDNRA>
{
final SimpleDateFormat gstFmt = new SimpleDateFormat("dd-MM-yyyy");
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
final SimpleDateFormat gstFmt = new SimpleDateFormat(gstCommonUtil.getGSTDateFormat());
@Override
public void serialize(CDNRA cdnra, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonProcessingException
{
......
......@@ -14,7 +14,8 @@ import ibase.webitm.bean.gst.InvLineItem;
public class CDNRSerializer extends JsonSerializer<CDNR>
{
final SimpleDateFormat gstFmt = new SimpleDateFormat("dd-MM-yyyy");
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
final SimpleDateFormat gstFmt = new SimpleDateFormat(gstCommonUtil.getGSTDateFormat());
@Override
public void serialize(CDNR cdnr, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonProcessingException
{
......
......@@ -14,7 +14,8 @@ import ibase.webitm.bean.gst.InvLineItem;
public class CDNURSerializer extends JsonSerializer<CDNUR>
{
final SimpleDateFormat gstFmt = new SimpleDateFormat("dd-MM-yyyy");
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
final SimpleDateFormat gstFmt = new SimpleDateFormat(gstCommonUtil.getGSTDateFormat());
@Override
public void serialize(CDNUR cdnur, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonProcessingException
{
......
......@@ -18,6 +18,7 @@ import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.bean.gst.APICallData;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
......@@ -484,6 +485,33 @@ public class GSTCommonUtil extends ValidatorEJB
return tranId;
}
public String getGSTDateFormat()
{
String dateFormat = "";
FinCommon finCommon = null;
Connection conn = null;
try
{
finCommon = new FinCommon();
conn = getConnection();
dateFormat = finCommon.getFinparams("999999", "GST_DATE_FORMAT", conn);
if("NULLFOUND".equalsIgnoreCase(dateFormat))
{
System.out.println("GST_DATE_FORMAT variable not found in finparam returning default format");
dateFormat = "dd-MM-yyyy";
}
System.out.println("return dateFormat["+dateFormat+"]");
}
catch(Exception e)
{
System.out.println("GSTCommonUtil.getGSTDateFormat()["+e.getMessage()+"]");
e.printStackTrace();
}
return dateFormat;
}
private static String checkNull(String input)
{
if (input==null)
......
......@@ -13,7 +13,8 @@ import ibase.webitm.bean.gst.InvLineItem;
public class IMPGSerializer extends JsonSerializer<IMPG>
{
final SimpleDateFormat gstFmt = new SimpleDateFormat("dd-MM-yyyy");
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
final SimpleDateFormat gstFmt = new SimpleDateFormat(gstCommonUtil.getGSTDateFormat());
@Override
public void serialize(IMPG impg, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonProcessingException
......
......@@ -13,7 +13,8 @@ import ibase.webitm.bean.gst.InvLineItem;
public class IMPSSerializer extends JsonSerializer<IMPS>
{
final SimpleDateFormat gstFmt = new SimpleDateFormat("dd-MM-yyyy");
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
final SimpleDateFormat gstFmt = new SimpleDateFormat(gstCommonUtil.getGSTDateFormat());
@Override
public void serialize(IMPS imps, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonProcessingException
......
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