Commit e938a3d0 authored by steurwadkar's avatar steurwadkar

F17ABAS001 GST API integration wizard source code commit

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@165102 ce508802-f39f-4f6c-b175-0d175dae99d5
parent da685ed9
......@@ -260,7 +260,16 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
break;
}
}
closeResources(rs, pstmt);
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("BASE_API_URL["+BASE_API_URL+"]");
System.out.println("AUTH_TOKEN_URL["+AUTH_TOKEN_URL+"]");
......@@ -349,6 +358,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
byte[] authSEK = null;
String loginCode = "", chgTerm = "", callStatus = "", responseId = "", responseJsonStr= "", recType = "";
String signDataXML = "", summaryDataJsonStr = "";
ArrayList<HashMap<String,String>> getGstrDataList = new ArrayList<HashMap<String,String>>();
ArrayList<String> byPassSectionList = new ArrayList<String>();
System.out.println(" -------- Inside itemchange case 2222222 ------------ ");
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ))
......@@ -397,6 +408,45 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
}
}
if("GETINV".equalsIgnoreCase(action))
{
sql = " SELECT TRAN_ID, RESPONSE_ID, CALL_DATE,CALL_TYPE"
+ " FROM API_CALL_LOG"
+ " WHERE SITE_CODE = ? AND REC_TYPE = ? AND PRD_CODE = ?"
+ " AND CALL_STATUS = ? AND CALL_TYPE LIKE '%GET%' AND RESPONSE_ID IS NOT NULL"
+ " ORDER BY CALL_DATE DESC";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, recType);
pstmt.setString(3, periodCode);
pstmt.setString(4, "0");
rs = pstmt.executeQuery();
while(rs.next())
{
HashMap<String,String> tempHMap = new HashMap<String,String>();
tempHMap.put("api_tranid", rs.getString("TRAN_ID"));
tempHMap.put("token", rs.getString("RESPONSE_ID"));
String tempStr = rs.getString("CALL_TYPE");
String section = tempStr.substring(tempStr.indexOf("_")+1);
tempHMap.put("section", section);
byPassSectionList.add(section);
getGstrDataList.add(tempHMap);
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
transactionId = UUID.randomUUID().toString().replaceAll("-", "");
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
......@@ -511,7 +561,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
retXML += summaryDataJsonStr;
}
retXML += downloadGstr1Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK);
retXML += downloadGstr1Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK, byPassSectionList);
}
else if("FILE".equalsIgnoreCase(action))
{
......@@ -527,7 +577,61 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
}
else if("GETINV".equalsIgnoreCase(action))
{
retXML += downloadGstr1Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK);
if(getGstrDataList.size() > 0)
{
for(HashMap<String,String> eachDataHamp : getGstrDataList)
{
String sectionName = eachDataHamp.get("section");
JSONObject dataJSONObject = new JSONObject();
dataJSONObject.put("token", eachDataHamp.get("token"));
dataJSONObject.put("est", "");
dataJSONObject.put("api_tranid", eachDataHamp.get("api_tranid"));
String retDataXML = getDataFromFileServer(gstinNo, recType, periodCode, authToken, userName, stateCode, authSEK, dataJSONObject, sectionName, xtraParams);
if("B2B".equalsIgnoreCase(sectionName))
{
retXML += "<b2b_invoices>" + retDataXML + "</b2b_invoices>";
}
else if("B2CL".equalsIgnoreCase(action))
{
retXML += "<b2cl_invoices>" + retDataXML + "</b2cl_invoices>";
}
else if("B2CS".equalsIgnoreCase(action))
{
retXML += "<b2cs_invoices>" + retDataXML + "</b2cs_invoices>";
}
else if("CDNR".equalsIgnoreCase(action))
{
retXML += "<cdnr_data>" + retDataXML + "</cdnr_data>";
}
else if("CDNUR".equalsIgnoreCase(action))
{
retXML += "<cdnur_data>" + retDataXML + "</cdnur_data>";
}
else if("AT".equalsIgnoreCase(action))
{
retXML += "<at_data>" + retDataXML +"</at_data>";
}
else if("TXP".equalsIgnoreCase(action))
{
retXML += "<txp_data>" + retDataXML + "</txp_data>";
}
else if("NIL".equalsIgnoreCase(action))
{
retXML += "<nil_data>" + retDataXML + "</nil_data>";
}
else if("EXP".equalsIgnoreCase(action))
{
retXML += "<exp_data>" + retDataXML + "</exp_data>";
}
else if("HSNSUM".equalsIgnoreCase(action))
{
retXML += "<hsnsum_data>" + retDataXML + "</hsnsum_data>";
}
}
}
retXML += downloadGstr1Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK, byPassSectionList);
}
}
if("GSTR2".equalsIgnoreCase(returnType))
......@@ -543,7 +647,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
retXML += summaryDataJsonStr;
}
retXML += downloadGstr2Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK);
retXML += downloadGstr2Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK, byPassSectionList);
}
else if("FILE".equalsIgnoreCase(action))
{
......@@ -559,7 +663,65 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
}
else if("GETINV".equalsIgnoreCase(action))
{
retXML += downloadGstr2Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK);
if(getGstrDataList.size() > 0)
{
for(HashMap<String,String> eachDataHamp : getGstrDataList)
{
String sectionName = eachDataHamp.get("section");
JSONObject dataJSONObject = new JSONObject();
dataJSONObject.put("token", eachDataHamp.get("token"));
dataJSONObject.put("est", "");
dataJSONObject.put("api_tranid", eachDataHamp.get("api_tranid"));
String retDataXML = getDataFromFileServer(gstinNo, recType, periodCode, authToken, userName, stateCode, authSEK, dataJSONObject, sectionName, xtraParams);
if("B2B".equalsIgnoreCase(sectionName))
{
retXML += "<b2b_invoices>" + retDataXML + "</b2b_invoices>";
}
else if("IMPG".equalsIgnoreCase(action))
{
retXML += "<impg_data>" + retDataXML + "</impg_data>";
}
else if("IMPS".equalsIgnoreCase(action))
{
retXML += "<imps_data>" + retDataXML + "</imps_data>";
}
else if("CDN".equalsIgnoreCase(action))
{
retXML += "<cdnr_data>" + retDataXML + "</cdnr_data>";
}
else if("CDNUR".equalsIgnoreCase(action))
{
retXML += "<cdnur_data>" + retDataXML + "</cdnur_data>";
}
else if("NIL".equalsIgnoreCase(action))
{
retXML += "<nil_data>" + retDataXML + "</nil_data>";
}
else if("TXLI".equalsIgnoreCase(action))
{
retXML += "<txli_data>" + retDataXML + "</txli_data>";
}
else if("TXP".equalsIgnoreCase(action))
{
retXML += "<txp_data>" + retDataXML + "</txp_data>";
}
else if("HSNSUM".equalsIgnoreCase(action))
{
retXML += "<hsnsum_data>" + retDataXML + "</hsnsum_data>";
}
else if("B2BUR".equalsIgnoreCase(action))
{
retXML += "<b2bur_data>" + retDataXML + "</b2bur_data>";
}
else if("ITCRVSL".equalsIgnoreCase(action))
{
retXML += "<itcrvsl_data>" + retDataXML + "</itcrvsl_data>";
}
}
}
retXML += downloadGstr2Data(gstinNo, periodCode, authToken, userName, stateCode, appKeyEncryptedAndCoded, xtraParams, authSEK, byPassSectionList);
}
}
if("GSTR3B".equalsIgnoreCase(returnType))
......@@ -1658,7 +1820,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
System.out.println("final retResonseXML ["+retResponseXML+"]");
return retResponseXML;
}
private String downloadGstr1Data (String gstinNo, String periodCode, String authToken, String userName, String stateCode, String appKeyEncryptedAndCoded, String xtraParams, byte[] authSek) throws ITMException
private String downloadGstr1Data (String gstinNo, String periodCode, String authToken, String userName, String stateCode, String appKeyEncryptedAndCoded, String xtraParams, byte[] authSek, ArrayList<String> byPassSectionList) throws ITMException
{
StringBuffer retStringBuff = new StringBuffer();
String[] gstr1Section = {"B2B","B2CL","B2CS","CDNR","AT","TXP","NIL","EXP","HSNSUM","CDNUR"};
......@@ -1672,6 +1834,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
for(String action : gstr1Section)
{
if(byPassSectionList != null && !byPassSectionList.contains(action))
{
long timeStamp = new Timestamp().getDateTime();
System.out.println("calling for ["+action+"]");
......@@ -1712,7 +1876,6 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
JSONObject getDataRespObj = getDataResp.getBody().getObject();
if(getDataRespObj.has("data") && getDataRespObj.has("rek"))
{
callStatus = "1";
String getdata = getDataRespObj.getString("data");
String getrek = getDataRespObj.getString("rek");
......@@ -1729,15 +1892,16 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
if(getJsonDataJsonObj.has("est") && getJsonDataJsonObj.has("token"))
{
responseId = getJsonDataJsonObj.getString("token");
callStatus = "0";
dataXML = getDataFromFileServer(gstinNo, "1", periodCode, authToken, userName, stateCode, authSek, getJsonDataJsonObj, action, xtraParams);
}
else
{
callStatus = "1";
dataXML = XML.toString(getJsonDataJsonObj);
//writeDatatoJsonFile(getJsonDataJsonObj.toString(), action);
}
if("B2B".equalsIgnoreCase(action))
{
retStringBuff.append("<b2b_invoices>");
......@@ -1840,6 +2004,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
gstCommonUtil.updateAPICallLogHistory(apiCallData, null);
}
}
}
catch (Exception e)
{
System.out.println("GSTDataSubmitWizEJB.downloadGstr1Data()["+e.getMessage()+"]");
......@@ -1849,7 +2014,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
System.out.println("final retStringBuff.toSting["+retStringBuff.toString()+"]");
return retStringBuff.toString();
}
private String downloadGstr2Data (String gstinNo, String periodCode, String authToken, String userName, String stateCode, String appKeyEncryptedAndCoded, String xtraParams, byte[] authSek) throws ITMException
private String downloadGstr2Data (String gstinNo, String periodCode, String authToken, String userName, String stateCode, String appKeyEncryptedAndCoded, String xtraParams, byte[] authSek, ArrayList<String> byPassSectionList) throws ITMException
{
StringBuffer retStringBuff = new StringBuffer();
String[] gstr2Section = {"B2B","IMPG","IMPS","CDN","NIL","TXLI","TXP","HSNSUM","B2BUR","ITCRVSL","CDNUR"};
......@@ -1863,6 +2028,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
for(String action : gstr2Section)
{
if(byPassSectionList != null && !byPassSectionList.contains(action))
{
long timeStamp = new Timestamp().getDateTime();
System.out.println("calling for ["+action+"]");
......@@ -2035,6 +2202,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
gstCommonUtil.updateAPICallLogHistory(apiCallData, null);
}
}
}
catch (Exception e)
{
System.out.println("GSTDataSubmitWizEJB.downloadGstr2Data()["+e.getMessage()+"]");
......@@ -2867,6 +3035,13 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
String transactionId = "", retFolderPath = "", gspAuthString = "", gspAuthSignature = "";
String siteCode = "", loginCode = "", chgTerm = "", responseId = "", responseJsonStr = "", callStatus = "";
String sep = File.separator;
String sql = "", apiTranId = "";
PreparedStatement pstmt = null;
Connection conn = null;
int updateCnt = 0;
boolean isError = false;
try
{
siteCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
......@@ -2951,7 +3126,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
if(tempJsonObj.has("ul"))
{
String fileUrl = tempJsonObj.getString("ul");
fileUrl = BASE_API_URL + fileUrl;
fileUrl = FILEDET_URL + fileUrl;
System.out.println("fileUrl["+fileUrl+"]");
URL url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
......@@ -3014,8 +3189,28 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
tarInput.close();
}
}
}
if(dataJSONObject.has("api_tranid"))
{
conn = getConnection();
apiTranId = dataJSONObject.getString("api_tranid");
sql = "UPDATE API_CALL_LOG SET CALL_STATUS = ? WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "1");
pstmt.setString(2, apiTranId);
updateCnt = pstmt.executeUpdate();
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
//retString = getDataXMLFromJsonFile(sectionName);
System.out.println("api call log update["+updateCnt+"] apiTranId["+apiTranId+"]");
}
}
else
......@@ -3050,6 +3245,28 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
retString = "<data_error><![CDATA["+errMsg+"]]></data_error>";
}
}
if(dataJSONObject.has("api_tranid"))
{
conn = getConnection();
apiTranId = dataJSONObject.getString("api_tranid");
sql = "UPDATE API_CALL_LOG SET CALL_STATUS = ? WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "1");
pstmt.setString(2, apiTranId);
updateCnt = pstmt.executeUpdate();
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
System.out.println("api call log update["+updateCnt+"] apiTranId["+apiTranId+"]");
}
}
APICallData apiCallData = new APICallData();
......@@ -3071,10 +3288,47 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
}
catch(Exception e)
{
isError = true;
System.out.println("GSTCommonUtil.getDataFromFileServer()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(isError)
{
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
if(conn!=null)
{
conn.rollback();
}
}
else
{
if(conn!=null)
{
conn.commit();
}
}
if(conn!=null && !conn.isClosed())
{
conn.close();
}
}
catch(Exception se)
{
System.out.println("GSTDataSubmitWizEJB.getDataFromFileServer().finally["+se.getMessage()+"]");
se.printStackTrace();
throw new ITMException(se);
}
}
System.out.println("final retString["+retString+"]");
return retString;
}
......
......@@ -212,6 +212,8 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
String loginCode = "", chgTerm = "", callStatus = "", responseId = "", responseJsonStr= "";
ArrayList<String> tranIdList = new ArrayList<String>();
ArrayList<HashMap<String,String>> getGstrDataList = new ArrayList<HashMap<String,String>>();
ArrayList<String> byPassSectionList = new ArrayList<String>();
APICallData apiCallData = null;
boolean isDataLogged = false;
......@@ -592,6 +594,45 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
System.out.println("tranIdList.size()["+tranIdList.size()+"]");
}
if("GETINV".equalsIgnoreCase(action))
{
sql = " SELECT TRAN_ID, RESPONSE_ID, CALL_DATE,CALL_TYPE"
+ " FROM API_CALL_LOG"
+ " WHERE SITE_CODE = ? AND REC_TYPE = ? AND PRD_CODE = ?"
+ " AND CALL_STATUS = ? AND CALL_TYPE LIKE '%GET%' AND RESPONSE_ID IS NOT NULL"
+ " ORDER BY CALL_DATE DESC";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, "4");
pstmt.setString(3, periodCode);
pstmt.setString(4, "0");
rs = pstmt.executeQuery();
while(rs.next())
{
HashMap<String,String> tempHMap = new HashMap<String,String>();
tempHMap.put("api_tranid", rs.getString("TRAN_ID"));
tempHMap.put("token", rs.getString("RESPONSE_ID"));
String tempStr = rs.getString("CALL_TYPE");
String section = tempStr.substring(tempStr.indexOf("_")+1);
tempHMap.put("section", section);
byPassSectionList.add(section);
getGstrDataList.add(tempHMap);
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
if(authToken != null && authToken.trim().length() > 0 && authSEK != null)
{
if("GSTR1".equalsIgnoreCase(returnsType))
......@@ -621,7 +662,20 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
{
if("GETINV".equalsIgnoreCase(action))
{
retString = downloadGstr2AData(siteCode, xtraParams, conn);
if(getGstrDataList.size() > 0)
{
for(HashMap<String,String> eachDataHamp : getGstrDataList)
{
String sectionName = eachDataHamp.get("section");
JSONObject dataJSONObject = new JSONObject();
dataJSONObject.put("token", eachDataHamp.get("token"));
dataJSONObject.put("est", "");
dataJSONObject.put("api_tranid", eachDataHamp.get("api_tranid"));
retString = getDataFromFileServer("4", dataJSONObject, sectionName, xtraParams, conn);
}
}
retString = downloadGstr2AData(siteCode, xtraParams, byPassSectionList, conn);
}
}
else if("GSTR2".equalsIgnoreCase(returnsType))
......@@ -3389,7 +3443,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
return retString;
}*/
private String downloadGstr2AData(String siteCode, String xtraParams, Connection conn) throws ITMException
private String downloadGstr2AData(String siteCode, String xtraParams, ArrayList<String> byPassSectionList, Connection conn) throws ITMException
{
String retString = "";
String errMsg = "", gspAuthString = "", gspAuthSignature = "";
......@@ -3404,6 +3458,8 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
for(String action : gstr2Section)
{
if(byPassSectionList != null && !byPassSectionList.contains(action))
{
System.out.println("calling for ["+action+"]");
long timeStamp = new Timestamp().getDateTime();
......@@ -3441,7 +3497,6 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
JSONObject getGstr2InvoicesRespObj = getGstr2InvoicesResp.getBody().getObject();
if(getGstr2InvoicesRespObj.has("data") && getGstr2InvoicesRespObj.has("rek"))
{
callStatus = "1";
String gstr2InvoicesData = getGstr2InvoicesRespObj.getString("data");
String gstr2InvoicesRek = getGstr2InvoicesRespObj.getString("rek");
......@@ -3456,10 +3511,13 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
if(gstr2InvoiceJsonObj.has("est") && gstr2InvoiceJsonObj.has("token"))
{
callStatus = "0";
responseId = gstr2InvoiceJsonObj.getString("token");
retString = getDataFromFileServer("4", gstr2InvoiceJsonObj, action, xtraParams, conn);
}
else
{
callStatus = "1";
if("B2B".equalsIgnoreCase(action))
{
insertB2BInvoiceData(stateCode, periodCode, siteCode, gstr2InvoiceJsonObj, xtraParams, conn);
......@@ -3511,7 +3569,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
apiCallData.setChgTerm(chgTerm);
apiCallDataList.add(apiCallData);
}
}
}
catch(Exception e)
......@@ -4428,6 +4486,13 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
String transactionId = "", gspAuthString = "", gspAuthSignature = "";
String siteCode = "", loginCode = "", chgTerm = "", responseId = "", responseJsonStr = "", callStatus = "";
String sep = File.separator;
String sql = "", apiTranId = "";
PreparedStatement pstmt = null;
Connection localConn = null;
int updateCnt = 0;
boolean isError = false;
try
{
siteCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
......@@ -4518,7 +4583,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
if(tempJsonObj.has("ul"))
{
String fileUrl = tempJsonObj.getString("ul");
fileUrl = BASE_API_URL + fileUrl;
fileUrl = FILEDET_URL + fileUrl;
System.out.println("fileUrl["+fileUrl+"]");
URL url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
......@@ -4590,6 +4655,26 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
}
}
if(dataJSONObject.has("api_tranid"))
{
apiTranId = dataJSONObject.getString("api_tranid");
sql = "UPDATE API_CALL_LOG SET CALL_STATUS = ? WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "1");
pstmt.setString(2, apiTranId);
updateCnt = pstmt.executeUpdate();
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
System.out.println("api call log update["+updateCnt+"] apiTranId["+apiTranId+"]");
}
}
else
{
......@@ -4623,6 +4708,27 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
retString = "<data_error><![CDATA["+errMsg+"]]></data_error>";
}
}
if(dataJSONObject.has("api_tranid"))
{
localConn = getConnection();
apiTranId = dataJSONObject.getString("api_tranid");
sql = "UPDATE API_CALL_LOG SET CALL_STATUS = ? WHERE TRAN_ID = ?";
pstmt = localConn.prepareStatement(sql);
pstmt.setString(1, "1");
pstmt.setString(2, apiTranId);
updateCnt = pstmt.executeUpdate();
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
System.out.println("api call log update["+updateCnt+"] apiTranId["+apiTranId+"]");
}
}
APICallData apiCallData = new APICallData();
......@@ -4644,10 +4750,45 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
catch(Exception e)
{
isError = true;
System.out.println("GSTDataSubmitWizPos.getDataFromFileServer()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(isError)
{
if(pstmt!=null)
{
pstmt.close();
pstmt=null;
}
if(localConn!=null)
{
localConn.rollback();
}
}
else
{
localConn.commit();
}
if(localConn!=null && !localConn.isClosed())
{
localConn.close();
localConn = null;
}
}
catch(SQLException se)
{
System.out.println("GSTDataSubmitWizPos.getDataFromFileServer().finally["+se.getMessage()+"]");
se.printStackTrace();
throw new ITMException(se);
}
}
System.out.println("final retString["+retString+"]");
return retString;
}
......
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