Commit 039def63 authored by steurwadkar's avatar steurwadkar

F17ABAS001 source code commit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106673 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 263a2d8e
......@@ -15,7 +15,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import javax.annotation.PostConstruct;
......@@ -521,11 +520,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
else if ("SUBMIT".equalsIgnoreCase(action))
{
retString = submitGstr1(xtraParams, conn);
retString = submitGstr("1", xtraParams, conn);
}
else if ("FILE".equalsIgnoreCase(action))
{
retString = fileGstr1(summaryData, signedData, panNo, aadhaarNo, signMethod, xtraParams, conn);
retString = fileGstr("1", summaryData, signedData, panNo, aadhaarNo, signMethod, xtraParams, conn);
}
}
else if("GSTR2A".equalsIgnoreCase(returnsType))
......@@ -543,11 +542,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
else if ("SUBMIT".equalsIgnoreCase(action))
{
retString = submitGstr2(xtraParams, conn);
retString = submitGstr("2", xtraParams, conn);
}
else if ("FILE".equalsIgnoreCase(action))
{
retString = fileGstr2(summaryData, signedData, panNo, aadhaarNo, signMethod, xtraParams, conn);
retString = fileGstr("2", summaryData, signedData, panNo, aadhaarNo, signMethod, xtraParams, conn);
}
}
else if("GSTR3B".equalsIgnoreCase(returnsType))
......@@ -1245,7 +1244,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
hsnDetails.description = checkNullandTrim(rs.getString("GS_DESCR"));
hsnDetails.unitOfMeasure = checkNullandTrim(rs.getString("UNIT"));
hsnDetails.quantity = rs.getDouble("TOT_QTY");
hsnDetails.totalAmount = rs.getDouble("TOT_TAXVAL");
hsnDetails.totalAmount = rs.getDouble("TOT_TAXVAL") + rs.getDouble("TOT_IAMT") + rs.getDouble("TOT_CAMT") + rs.getDouble("TOT_SAMT") + rs.getDouble("TOT_CSAMT");
hsnDetails.totalTaxableAmount = rs.getDouble("TOT_TAXVAL");
hsnDetails.totalIGSTAmount = rs.getDouble("TOT_IAMT");
hsnDetails.totalCGSTAmount = rs.getDouble("TOT_CAMT");
......@@ -1532,9 +1531,9 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
return retString;
}
private String submitGstr1(String xtraParams,Connection conn) throws ITMException
private String submitGstr(String recType, String xtraParams,Connection conn) throws ITMException
{
String retString = "";
String retString = "", RETURN_URL = "";
String errMsg = "", gspAuthString = "", gspAuthSignature = "";
String transactionId = UUID.randomUUID().toString().replaceAll("-", "");
String loginCode = "", chgTerm = "", siteCode = "", callStatus = "", responseJsonStr = "", responseId = "";
......@@ -1545,6 +1544,23 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
try
{
if("1".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR1_URL;
}
else if("2".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR2_URL;
}
else if("3".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR3_URL;
}
else if("6".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR3B_URL;
}
siteCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
......@@ -1570,7 +1586,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest gstr1SubmitReq = Unirest.post(String.format("%s%s", BASE_API_URL, GSTR1_URL))
HttpRequest gstrSubmitReq = Unirest.post(String.format("%s%s", BASE_API_URL, RETURN_URL))
.header("Content-Type", APPLICATION_JSON)
.header("action", "RETSUBMIT")
.header("state-cd", stateCode)
......@@ -1587,31 +1603,31 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
.body(new JsonNode(reqBody.toString()))
.getHttpRequest();
System.out.println("RETSUBMIT GSTR1 url["+gstr1SubmitReq.getUrl()+"]");
System.out.println("RETSUBMIT GSTR1 method["+gstr1SubmitReq.getHttpMethod()+"]");
System.out.println("RETSUBMIT GSTR1 request header["+gstr1SubmitReq.getHeaders()+"]");
System.out.println("RETSUBMIT GSTR1 request payload["+IOUtils.toString(gstr1SubmitReq.getBody().getEntity().getContent())+"]");
System.out.println("RETSUBMIT GSTR"+recType+" url["+gstrSubmitReq.getUrl()+"]");
System.out.println("RETSUBMIT GSTR"+recType+" method["+gstrSubmitReq.getHttpMethod()+"]");
System.out.println("RETSUBMIT GSTR"+recType+" request header["+gstrSubmitReq.getHeaders()+"]");
System.out.println("RETSUBMIT GSTR"+recType+" request payload["+IOUtils.toString(gstrSubmitReq.getBody().getEntity().getContent())+"]");
HttpResponse<JsonNode> gstr1SubmitResp = gstr1SubmitReq.asJson();
HttpResponse<JsonNode> gstrSubmitResp = gstrSubmitReq.asJson();
System.out.println(String.format("gstr1SubmitResp Request : Status[%s] Response[%s]", gstr1SubmitResp.getStatus(), gstr1SubmitResp.getBody()));
System.out.println(String.format("gstrSubmitResp Request : Status[%s] Response[%s]", gstrSubmitResp.getStatus(), gstrSubmitResp.getBody()));
if (gstr1SubmitResp.getStatus() == 200)
if (gstrSubmitResp.getStatus() == 200)
{
JSONObject gstr1SubmitRespObj = gstr1SubmitResp.getBody().getObject();
if(gstr1SubmitRespObj.has("data") && gstr1SubmitRespObj.has("rek"))
JSONObject gstrSubmitRespObj = gstrSubmitResp.getBody().getObject();
if(gstrSubmitRespObj.has("data") && gstrSubmitRespObj.has("rek"))
{
callStatus = "1";
String gstr1Submitdata = gstr1SubmitRespObj.getString("data");
String gstr1Submitrek = gstr1SubmitRespObj.getString("rek");
String gstrSubmitdata = gstrSubmitRespObj.getString("data");
String gstrSubmitrek = gstrSubmitRespObj.getString("rek");
byte[] apiEK = aesEncryption.decrypt(gstr1Submitrek, authSEK);
String respJsoninBase64 = new String(aesEncryption.decrypt(gstr1Submitdata, apiEK));
byte[] apiEK = aesEncryption.decrypt(gstrSubmitrek, authSEK);
String respJsoninBase64 = new String(aesEncryption.decrypt(gstrSubmitdata, apiEK));
byte[] respJsonInBytes = aesEncryption.decodeBase64StringTOByte(respJsoninBase64);
JSONObject gstr1SubmitObj = new JSONObject(new String(respJsonInBytes));
String transId = gstr1SubmitObj.getString("reference_id");
JSONObject gstrSubmitObj = new JSONObject(new String(respJsonInBytes));
String transId = gstrSubmitObj.getString("reference_id");
responseId = transId;
System.out.println("transId to getStatus after SUBMIT call["+transId+"]");
......@@ -1637,35 +1653,43 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
else
{
callStatus = "2";
JSONObject errorJSON = gstr1SubmitResp.getBody().getObject().getJSONObject("error");
JSONObject errorJSON = gstrSubmitResp.getBody().getObject().getJSONObject("error");
responseJsonStr = errorJSON.toString();
errMsg = "Message : "+errorJSON.getString("message")+" \nError code : "+errorJSON.getString("error_cd");
retString = getError(errMsg, "GSTAPIERR", conn);
}
}
else if(gstr1SubmitResp.getStatus() == 500)
else if(gstrSubmitResp.getStatus() == 500)
{
callStatus = "2";
errMsg = "Message : Error occurred at GSTN server \nResponse code : "+gstr1SubmitResp.getStatus();
errMsg = "Message : Error occurred at GSTN server \nResponse code : "+gstrSubmitResp.getStatus();
responseJsonStr = errMsg;
retString = getError(errMsg, "GSTAPIERR", conn);
}
else
{
callStatus = "2";
JSONObject errorJSON = gstr1SubmitResp.getBody().getObject().getJSONObject("error");
JSONObject errorJSON = gstrSubmitResp.getBody().getObject().getJSONObject("error");
responseJsonStr = errorJSON.toString();
errMsg = "Message : "+errorJSON.getString("message")+" \nError code : "+errorJSON.getString("error_cd");
retString = getError(errMsg, "GSTAPIERR", conn);
}
APICallData apiCallData = new APICallData();
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.submitGstr()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
APICallData apiCallData = new APICallData();
apiCallData.setPeriodCode(periodCode);
apiCallData.setCallDate(new Date());
apiCallData.setSiteCode(siteCode);
apiCallData.setUserId(loginCode);
apiCallData.setCallType("RETSUBMIT");
apiCallData.setRecType("1");
apiCallData.setRecType(recType);
apiCallData.setNoOfRecords(0);
apiCallData.setCallStatus(callStatus);
apiCallData.setResponseId(responseId);
......@@ -1676,23 +1700,34 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
gstCommonUtil.updateAPICallLogHistory(apiCallData, null);
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.submitGstr1()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
return retString;
}
private String fileGstr1(String summaryData, String signedData, String panNo, String aadhaarNo, String signMethod, String xtraParams, Connection conn) throws ITMException
private String fileGstr(String recType, String summaryData, String signedData, String panNo, String aadhaarNo, String signMethod, String xtraParams, Connection conn) throws ITMException
{
String retString = "";
String retString = "", RETURN_URL = "";
String errMsg = "", gspAuthString = "", gspAuthSignature = "", signType = "",signId = "";
String transactionId = UUID.randomUUID().toString().replaceAll("-", "");
String loginCode = "", chgTerm = "", siteCode = "", callStatus = "", responseJsonStr = "", responseId = "";
try
{
if("1".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR1_URL;
}
else if("2".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR2_URL;
}
else if("3".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR3_URL;
}
else if("6".equalsIgnoreCase(recType))
{
RETURN_URL = GSTR3B_URL;
}
siteCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
......@@ -1722,61 +1757,61 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
signId = aadhaarNo;
}
JSONObject fileGstr1DataJsonObj = new JSONObject();
fileGstr1DataJsonObj.put("action", "RETFILE");
fileGstr1DataJsonObj.put("data", encryptedPayload);
fileGstr1DataJsonObj.put("hmac", new String(Base64.getEncoder().encode(resBuf)));
fileGstr1DataJsonObj.put("sign", signedData);
fileGstr1DataJsonObj.put("st", signType);
fileGstr1DataJsonObj.put("sid", signId);
JSONObject fileGstrDataJsonObj = new JSONObject();
fileGstrDataJsonObj.put("action", "RETFILE");
fileGstrDataJsonObj.put("data", encryptedPayload);
fileGstrDataJsonObj.put("hmac", new String(Base64.getEncoder().encode(resBuf)));
fileGstrDataJsonObj.put("sign", signedData);
fileGstrDataJsonObj.put("st", signType);
fileGstrDataJsonObj.put("sid", signId);
HttpRequest fileGstr1Req = Unirest.post(String.format("%s%s", BASE_API_URL, GSTR1_URL))
.header("Content-Type", APPLICATION_JSON)
.header("state-cd", stateCode)
.header("clientid", clientId)
.header("client-secret", clientSecret)
.header("ip-usr", ipAddress)
.header("username", userName)
.header("auth-token", authToken)
.header("txn", transactionId)
.header("ret_period", periodCode)
.header("gstin", gstin)
.header("X-Asp-Auth-Token", gspAuthString)
.header("X-Asp-Auth-Signature", gspAuthSignature)
.body(new JsonNode(fileGstr1DataJsonObj.toString()))
.getHttpRequest();
HttpRequest fileGstrReq = Unirest.post(String.format("%s%s", BASE_API_URL, RETURN_URL))
.header("Content-Type", APPLICATION_JSON)
.header("state-cd", stateCode)
.header("clientid", clientId)
.header("client-secret", clientSecret)
.header("ip-usr", ipAddress)
.header("username", userName)
.header("auth-token", authToken)
.header("txn", transactionId)
.header("ret_period", periodCode)
.header("gstin", gstin)
.header("X-Asp-Auth-Token", gspAuthString)
.header("X-Asp-Auth-Signature", gspAuthSignature)
.body(new JsonNode(fileGstrDataJsonObj.toString()))
.getHttpRequest();
System.out.println("FILE GSTR1 url["+fileGstr1Req.getUrl()+"]");
System.out.println("FILE GSTR1 method["+fileGstr1Req.getHttpMethod()+"]");
System.out.println("FILE GSTR1 request header["+fileGstr1Req.getHeaders()+"]");
System.out.println("FILE GSTR1 request payload["+IOUtils.toString(fileGstr1Req.getBody().getEntity().getContent())+"]");
System.out.println("FILE GSTR"+recType+" url["+fileGstrReq.getUrl()+"]");
System.out.println("FILE GSTR"+recType+" method["+fileGstrReq.getHttpMethod()+"]");
System.out.println("FILE GSTR"+recType+" request header["+fileGstrReq.getHeaders()+"]");
System.out.println("FILE GSTR"+recType+" request payload["+IOUtils.toString(fileGstrReq.getBody().getEntity().getContent())+"]");
HttpResponse<JsonNode> fileGstr1Resp = fileGstr1Req.asJson();
HttpResponse<JsonNode> fileGstrResp = fileGstrReq.asJson();
System.out.println(String.format("fileGstr1Resp Request : Status[%s] Response[%s]", fileGstr1Resp.getStatus(), fileGstr1Resp.getBody()));
if (fileGstr1Resp.getStatus() == 200)
System.out.println(String.format("fileGstrResp Request : Status[%s] Response[%s]", fileGstrResp.getStatus(), fileGstrResp.getBody()));
if (fileGstrResp.getStatus() == 200)
{
JSONObject fileGstr1RespObj = fileGstr1Resp.getBody().getObject();
if(fileGstr1RespObj.has("data") && fileGstr1RespObj.has("rek"))
JSONObject fileGstrRespObj = fileGstrResp.getBody().getObject();
if(fileGstrRespObj.has("data") && fileGstrRespObj.has("rek"))
{
callStatus = "1";
String fileGstr1Data = fileGstr1RespObj.getString("data");
String fileGstr1Rek = fileGstr1RespObj.getString("rek");
String fileGstrData = fileGstrRespObj.getString("data");
String fileGstrRek = fileGstrRespObj.getString("rek");
byte[] fileGstr1ApiEK = aesEncryption.decrypt(fileGstr1Rek, authSEK);
byte[] fileGstrApiEK = aesEncryption.decrypt(fileGstrRek, authSEK);
String fileGstr1JsoninBase64 = new String(aesEncryption.decrypt(fileGstr1Data, fileGstr1ApiEK));
String fileGstrJsoninBase64 = new String(aesEncryption.decrypt(fileGstrData, fileGstrApiEK));
byte[] fileGstr1JsonInBytes = aesEncryption.decodeBase64StringTOByte(fileGstr1JsoninBase64);
byte[] fileGstrJsonInBytes = aesEncryption.decodeBase64StringTOByte(fileGstrJsoninBase64);
System.out.println(new String(fileGstr1JsonInBytes));
System.out.println(new String(fileGstrJsonInBytes));
responseId = new String(fileGstr1JsonInBytes);
responseId = new String(fileGstrJsonInBytes);
}
else
{
callStatus = "2";
JSONObject errorJSON = fileGstr1Resp.getBody().getObject().getJSONObject("error");
JSONObject errorJSON = fileGstrResp.getBody().getObject().getJSONObject("error");
responseJsonStr = errorJSON.toString();
errMsg = "Message : "+errorJSON.getString("message")+" \nError code : "+errorJSON.getString("error_cd");
retString = getError(errMsg, "GSTAPIERR", conn);
......@@ -1785,19 +1820,27 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
else
{
callStatus = "2";
JSONObject errorJSON = fileGstr1Resp.getBody().getObject().getJSONObject("error");
JSONObject errorJSON = fileGstrResp.getBody().getObject().getJSONObject("error");
responseJsonStr = errorJSON.toString();
errMsg = "Message : "+errorJSON.getString("message")+" \nError code : "+errorJSON.getString("error_cd");
retString = getError(errMsg, "GSTAPIERR", conn);
}
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.fileGstr1()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
APICallData apiCallData = new APICallData();
apiCallData.setPeriodCode(periodCode);
apiCallData.setCallDate(new Date());
apiCallData.setSiteCode(siteCode);
apiCallData.setUserId(loginCode);
apiCallData.setCallType("RETFILE");
apiCallData.setRecType("1");
apiCallData.setRecType(recType);
apiCallData.setNoOfRecords(0);
apiCallData.setCallStatus(callStatus);
apiCallData.setResponseId(responseId);
......@@ -1807,13 +1850,6 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
apiCallData.setChgTerm(chgTerm);
gstCommonUtil.updateAPICallLogHistory(apiCallData, null);
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.fileGstr1()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
return retString;
......@@ -2381,13 +2417,13 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
b2burInvoiceList.add(b2bur);
}
}
if("CDNR".equalsIgnoreCase(udfStr1))
if("CDN".equalsIgnoreCase(udfStr1))
{
Calendar calendar = Calendar.getInstance();
calendar.set(2017, 06, 01);
Date gstStartDate = calendar.getTime();
if("CDNR".equalsIgnoreCase(udfStr1))
if("CDN".equalsIgnoreCase(udfStr1))
{
lineSql = " SELECT GST_RATE, SUM(TAXABLE_AMT) AS TAXABLE_AMT, SUM(IGST_AMT) AS IGST_AMT, SUM(CGST_AMT) AS CGST_AMT, SUM(SGST_AMT) AS SGST_AMT, SUM(CESS_AMT) AS CESS_AMT, "
+ " ITC_TYPE, SUM(ITC_IGST) AS ITC_IGST, SUM(ITC_CGST) AS ITC_CGST, SUM(ITC_SGST) AS ITC_SGST, SUM(ITC_CESS) AS ITC_CESS "
......@@ -2454,7 +2490,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
cdnrList.add(cdnr);
}
}
if("IMPG".equalsIgnoreCase(udfStr1))
if("IMP_G".equalsIgnoreCase(udfStr1))
{
String sezGSTIN = "";
......@@ -2507,15 +2543,15 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
{
impg.isSezImport = false;
}
impg.billOfEntryNo = checkNullandTrim(rs.getString("DOC_NO"));
impg.billOfEntryDate = rs.getDate("DOC_DATE");
impg.billOfEntryNo = checkNullandTrim(rs.getString("LR_NO"));
impg.billOfEntryDate = rs.getDate("LR_DATE");
impg.amount = rs.getDouble("AMOUNT");
impg.portCode = checkNullandTrim(rs.getString("ORDER_NO"));
impg.items = invLineItems;
impgList.add(impg);
}
if("IMPS".equalsIgnoreCase(udfStr1))
if("IMP_S".equalsIgnoreCase(udfStr1))
{
lineSql = " SELECT GST_RATE, SUM(TAXABLE_AMT) AS TAXABLE_AMT, SUM(IGST_AMT) AS IGST_AMT, SUM(CGST_AMT) AS CGST_AMT, SUM(SGST_AMT) AS SGST_AMT, SUM(CESS_AMT) AS CESS_AMT, "
+ " ITC_TYPE, SUM(ITC_IGST) AS ITC_IGST, SUM(ITC_CGST) AS ITC_CGST, SUM(ITC_SGST) AS ITC_SGST, SUM(ITC_CESS) AS ITC_CESS "
......@@ -2560,11 +2596,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
imps.idt = rs.getDate("DOC_DATE");
imps.val = rs.getDouble("AMOUNT");
imps.pos = checkNullandTrim(rs.getString("GST_CODE"));
impg.items = invLineItems;
imps.items = invLineItems;
impsList.add(imps);
}
if("TXI".equalsIgnoreCase(udfStr1))
if("TXPI".equalsIgnoreCase(udfStr1))
{
lineSql = " SELECT GST_RATE, SUM(TAXABLE_AMT) AS TAXABLE_AMT, SUM(IGST_AMT) AS IGST_AMT, SUM(CGST_AMT) AS CGST_AMT, SUM(SGST_AMT) AS SGST_AMT, SUM(CESS_AMT) AS CESS_AMT, "
+ " ITC_TYPE, SUM(ITC_IGST) AS ITC_IGST, SUM(ITC_CGST) AS ITC_CGST, SUM(ITC_SGST) AS ITC_SGST, SUM(ITC_CESS) AS ITC_CESS "
......@@ -2755,7 +2791,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
hsnDetails.description = checkNullandTrim(rs.getString("GS_DESCR"));
hsnDetails.unitOfMeasure = checkNullandTrim(rs.getString("UNIT"));
hsnDetails.quantity = rs.getDouble("TOT_QTY");
hsnDetails.totalAmount = rs.getDouble("TOT_TAXVAL");
hsnDetails.totalAmount = rs.getDouble("TOT_TAXVAL") + rs.getDouble("TOT_IAMT") + rs.getDouble("TOT_CAMT") + rs.getDouble("TOT_SAMT") + rs.getDouble("TOT_CSAMT");
hsnDetails.totalTaxableAmount = rs.getDouble("TOT_TAXVAL");
hsnDetails.totalIGSTAmount = rs.getDouble("TOT_IAMT");
hsnDetails.totalCGSTAmount = rs.getDouble("TOT_CAMT");
......@@ -2782,8 +2818,8 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
hsn.hsnDetails = hsnList;
}
InterNilSupplies interNilSupplies = getInterNilRateSummary("13", "14", "15", "16", siteCode, periodCode, conn);
IntraNilSupplies intraNilSupplies = getIntraNilRateSummary("17", "18", "19", "20", siteCode, periodCode, conn);
InterNilSupplies interNilSupplies = getInterNilRateSummary("18", "19", "20", "21", siteCode, periodCode, conn);
IntraNilSupplies intraNilSupplies = getIntraNilRateSummary("22", "23", "24", "25", siteCode, periodCode, conn);
if(interNilSupplies != null || intraNilSupplies != null)
{
......@@ -2856,7 +2892,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
return retString;
}
private String submitGstr2(String xtraParams,Connection conn) throws ITMException
/*private String submitGstr2(String xtraParams,Connection conn) throws ITMException
{
String retString = "";
String errMsg = "", gspAuthString = "", gspAuthSignature = "";
......@@ -3008,8 +3044,8 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
throw new ITMException(e);
}
return retString;
}
private String fileGstr2(String summaryData, String signedData, String panNo, String aadhaarNo, String signMethod, String xtraParams, Connection conn) throws ITMException
}*/
/*private String fileGstr2(String summaryData, String signedData, String panNo, String aadhaarNo, String signMethod, String xtraParams, Connection conn) throws ITMException
{
String retString = "";
String errMsg = "", gspAuthString = "", gspAuthSignature = "", signType = "",signId = "";
......@@ -3140,7 +3176,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
return retString;
}
}*/
private String createGstr3bJson(String siteCode, String xtraParams, Connection conn) throws ITMException
{
String retString = "";
......@@ -4162,7 +4198,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
}
}
private void insertIMGInvoiceData(String stateCode, String periodCode, String siteCode, JSONObject gstr2InvoiceJsonObj, Connection conn) throws ITMException
/*private void insertIMGInvoiceData(String stateCode, String periodCode, String siteCode, JSONObject gstr2InvoiceJsonObj, Connection conn) throws ITMException
{
JSONArray imgInvoiceArry = new JSONArray();
JSONObject imgJsonObj = new JSONObject();
......@@ -4460,7 +4496,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
e.printStackTrace();
throw new ITMException(e);
}
}
}*/
private void insertCDNData(String stateCode, String periodCode, String siteCode, JSONObject gstr2InvoiceJsonObj, String xtraParams, Connection conn) throws ITMException
{
JSONArray cdnArry = new JSONArray();
......@@ -4693,7 +4729,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
}
}
private void insertNILData(String stateCode, String periodCode, String siteCode, JSONObject gstr2InvoiceJsonObj, Connection conn) throws ITMException
/*private void insertNILData(String stateCode, String periodCode, String siteCode, JSONObject gstr2InvoiceJsonObj, Connection conn) throws ITMException
{
JSONObject nilJsonObj = null, nilInterJsonObj = null, nilIntraJsonObj = null;
HashMap<String, String> nilSuppliesAmtHMap = null;
......@@ -4936,7 +4972,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
e.printStackTrace();
throw new ITMException(e);
}
}
}*/
private void updateSubmissionStatus(ArrayList<String> tranIdList, Connection conn) throws ITMException
{
String updateSql = "";
......@@ -5052,40 +5088,50 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
{
eachInvErrorJsonArry = errorJsonObj.getJSONArray("b2bur");
}
else if(errorJsonObj.has("cdn"))
{
eachInvErrorJsonArry = errorJsonObj.getJSONArray("cdn");
}
else if(errorJsonObj.has("nldt"))
{
eachInvErrorJsonArry = errorJsonObj.getJSONArray("nldt");
}
for(int i=0; i<eachInvErrorJsonArry.length(); i++)
if(eachInvErrorJsonArry != null)
{
JSONObject tempJsonObj = eachInvErrorJsonArry.getJSONObject(i);
if(tempJsonObj.has("error_msg"))
{
retString += tempJsonObj.getString("error_msg")+"\n";
}
if(tempJsonObj.has("ty") && tempJsonObj.has("hsn_sc"))
{
retString += " Line Type : "+tempJsonObj.optString("ty")+ " Item/Service Code : "+tempJsonObj.optString("hsn_sc")+"\n";
}
else if(tempJsonObj.has("nt_num") && tempJsonObj.has("nt_dt"))
{
retString += " Credit/Debit No. : "+tempJsonObj.optString("nt_num")+ " Credit/Debit Dt. : "+tempJsonObj.optString("nt_dt")+"\n";
}
else if(tempJsonObj.has("doc_num") && tempJsonObj.has("doc_dt") && tempJsonObj.has("typ"))
{
retString += " Doc No. : "+tempJsonObj.optString("doc_num")+ " Doc Dt. : "+tempJsonObj.optString("doc_dt")+ " Inv Type : "+tempJsonObj.optString("typ")+"\n";
}
else if(tempJsonObj.has("inum") && tempJsonObj.has("idt"))
for(int i=0; i<eachInvErrorJsonArry.length(); i++)
{
retString += " Invoice No. : "+tempJsonObj.optString("inum")+ " Invoice Dt. : "+tempJsonObj.optString("idt")+"\n";
}
else if(tempJsonObj.has("inv"))
{
JSONArray tempInvJsonArry = tempJsonObj.getJSONArray("inv");
for(int j=0; j<tempInvJsonArry.length(); j++)
JSONObject tempJsonObj = eachInvErrorJsonArry.getJSONObject(i);
if(tempJsonObj.has("error_msg"))
{
JSONObject tempInvJsonObj = tempInvJsonArry.getJSONObject(j);
if(tempInvJsonObj.has("inum") && tempInvJsonObj.has("idt"))
retString += tempJsonObj.getString("error_msg")+"\n";
}
if(tempJsonObj.has("ty") && tempJsonObj.has("hsn_sc"))
{
retString += " Line Type : "+tempJsonObj.optString("ty")+ " Item/Service Code : "+tempJsonObj.optString("hsn_sc")+"\n";
}
else if(tempJsonObj.has("nt_num") && tempJsonObj.has("nt_dt"))
{
retString += " Credit/Debit No. : "+tempJsonObj.optString("nt_num")+ " Credit/Debit Dt. : "+tempJsonObj.optString("nt_dt")+"\n";
}
else if(tempJsonObj.has("doc_num") && tempJsonObj.has("doc_dt") && tempJsonObj.has("typ"))
{
retString += " Doc No. : "+tempJsonObj.optString("doc_num")+ " Doc Dt. : "+tempJsonObj.optString("doc_dt")+ " Inv Type : "+tempJsonObj.optString("typ")+"\n";
}
else if(tempJsonObj.has("inum") && tempJsonObj.has("idt"))
{
retString += " Invoice No. : "+tempJsonObj.optString("inum")+ " Invoice Dt. : "+tempJsonObj.optString("idt")+"\n";
}
else if(tempJsonObj.has("inv"))
{
JSONArray tempInvJsonArry = tempJsonObj.getJSONArray("inv");
for(int j=0; j<tempInvJsonArry.length(); j++)
{
retString += " Invoice No. : "+tempInvJsonObj.optString("inum")+ " Invoice Dt. : "+tempInvJsonObj.optString("idt")+"\n";
JSONObject tempInvJsonObj = tempInvJsonArry.getJSONObject(j);
if(tempInvJsonObj.has("inum") && tempInvJsonObj.has("idt"))
{
retString += " Invoice No. : "+tempInvJsonObj.optString("inum")+ " Invoice Dt. : "+tempInvJsonObj.optString("idt")+"\n";
}
}
}
}
......@@ -5440,7 +5486,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
long retSaveDiffMinutes = retSaveDiff / (60 * 1000) % 60;
long retSaveDiffHours = retSaveDiff / (60 * 60 * 1000);
System.out.println("DIFFERANCE IN TIME FOR RETSAVE GSTR1 IN HH:MM:SS ["+retSaveDiffHours +":"+retSaveDiffMinutes+":"+retSaveDiffSeconds+"]");
System.out.println("DIFFERANCE IN TIME FOR RETSAVE GSTR1 ["+gstin+"] IN HH:MM:SS ["+retSaveDiffHours +":"+retSaveDiffMinutes+":"+retSaveDiffSeconds+"]");
boolean isRetStatusError = false;
......@@ -5644,9 +5690,17 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
long diffStatsMinutes = diffStatus / (60 * 1000) % 60;
long diffStatsHours = diffStatus / (60 * 60 * 1000);
System.out.println("DIFFERANCE IN TIME FOR RETSTATUS GSTR1 IN HH:MM:SS ["+diffStatsHours +":"+diffStatsMinutes+":"+diffStatsSeconds+"]");
System.out.println("DIFFERANCE IN TIME FOR SAVE GSTR1 IN HH:MM:SS ["+diffHours +":"+diffMinutes+":"+diffSeconds+"]");
System.out.println("DIFFERANCE IN TIME FOR RETSTATUS GSTR1 ["+gstin+"] IN HH:MM:SS ["+diffStatsHours +":"+diffStatsMinutes+":"+diffStatsSeconds+"]");
System.out.println("DIFFERANCE IN TIME FOR SAVE GSTR1 ["+gstin+"] IN HH:MM:SS ["+diffHours +":"+diffMinutes+":"+diffSeconds+"]");
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.saveGSTRData()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
APICallData apiCallData = new APICallData();
apiCallData.setPeriodCode(periodCode);
apiCallData.setCallDate(new Date());
......@@ -5671,15 +5725,9 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
}
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.saveGSTRData()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
return retString;
}
private void insertGSTHdrDetData(List<String> hdrColumnList, List<String> hdrDataTypeList, List<String> hdrDataList, List<String> detColumnList, List<String> detDataTypeList, List<List<String>> detDataList, Connection conn) throws ITMException
/*private void insertGSTHdrDetData(List<String> hdrColumnList, List<String> hdrDataTypeList, List<String> hdrDataList, List<String> detColumnList, List<String> detDataTypeList, List<List<String>> detDataList, Connection conn) throws ITMException
{
boolean isError = false;
PreparedStatement hdrPstmt = null, detPstmt = null;
......@@ -5856,7 +5904,7 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
se.printStackTrace();
}
}
}
}*/
private static String checkNullandTrim(String input)
{
......
......@@ -52,7 +52,7 @@ public class CDNRSerializer extends JsonSerializer<CDNR>
json.writeStringField("rsn", cdnDetails.reason);
}
json.writeStringField("p_gst", cdnDetails.isPreGSTInvoice ? "Y" : "N");
if(cdnDetails.taxPayerAction != null)
if(cdnDetails.taxPayerAction != null && cdnDetails.taxPayerAction.length() > 0)
{
json.writeStringField("flag", cdnDetails.taxPayerAction);
}
......@@ -127,7 +127,7 @@ public class CDNRSerializer extends JsonSerializer<CDNR>
}
json.writeEndObject();
if(li.itcType != null && (li.igstInputTax > 0.0 || li.cgstInputTax > 0.0 || li.sgstInputTax > 0.0) || li.cessInputTax > 0.0)
if(li.itcType != null)
{
json.writeFieldName("itc");
json.writeStartObject();
......
......@@ -19,65 +19,74 @@ public class IMPGSerializer extends JsonSerializer<IMPG>
@Override
public void serialize(IMPG impg, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonProcessingException
{
json.writeStartObject();
json.writeStringField("is_sez", impg.isSezImport ? "Y" : "N");
if(impg.isSezImport)
{
json.writeStringField("stin", impg.sezGSTIN);
}
json.writeStringField("boe_num", impg.billOfEntryNo);
json.writeStringField("boe_dt", gstFmt.format(impg.billOfEntryDate));
json.writeNumberField("boe_val", impg.amount);
json.writeStringField("port_code", impg.portCode);
json.writeFieldName("itms");
json.writeStartArray();
for(InvLineItem li : impg.items)
try
{
json.writeStartObject();
json.writeNumberField("num", li.num);
json.writeNumberField("txval", li.taxval);
json.writeNumberField("rt", li.rate);
if(li.iamt > 0.0)
{
json.writeNumberField("iamt", li.iamt);
}
if(li.camt > 0.0)
{
json.writeNumberField("camt", li.camt);
}
if(li.samt > 0.0)
{
json.writeNumberField("samt", li.samt);
}
if(li.csamt > 0.0)
{
json.writeNumberField("csamt", li.csamt);
}
json.writeStringField("elg", li.itcType);
json.writeNumberField("tx_i", li.igstInputTax);
if(li.cgstInputTax > 0.0)
json.writeStringField("is_sez", impg.isSezImport ? "Y" : "N");
if(impg.isSezImport)
{
json.writeNumberField("tx_c", li.cgstInputTax);
json.writeStringField("stin", impg.sezGSTIN);
}
if(li.sgstInputTax > 0.0)
json.writeStringField("boe_num", impg.billOfEntryNo);
json.writeStringField("boe_dt", gstFmt.format(impg.billOfEntryDate));
json.writeNumberField("boe_val", impg.amount);
json.writeStringField("port_code", impg.portCode);
json.writeFieldName("itms");
json.writeStartArray();
for(InvLineItem li : impg.items)
{
json.writeNumberField("tx_s", li.sgstInputTax);
json.writeStartObject();
json.writeNumberField("num", li.num);
json.writeNumberField("txval", li.taxval);
json.writeNumberField("rt", li.rate);
if(li.iamt > 0.0)
{
json.writeNumberField("iamt", li.iamt);
}
if(li.camt > 0.0)
{
json.writeNumberField("camt", li.camt);
}
if(li.samt > 0.0)
{
json.writeNumberField("samt", li.samt);
}
if(li.csamt > 0.0)
{
json.writeNumberField("csamt", li.csamt);
}
json.writeStringField("elg", li.itcType);
json.writeNumberField("tx_i", li.igstInputTax);
if(li.cgstInputTax > 0.0)
{
json.writeNumberField("tx_c", li.cgstInputTax);
}
if(li.sgstInputTax > 0.0)
{
json.writeNumberField("tx_s", li.sgstInputTax);
}
json.writeNumberField("tx_cs", li.cessInputTax);
json.writeEndObject();
}
json.writeNumberField("tx_cs", li.cessInputTax);
json.writeEndObject();
json.writeEndArray();
json.writeEndObject();
}
json.writeEndArray();
json.writeEndObject();
catch(Exception e)
{
System.out.println("IMPGSerializer.serialize()["+e.getMessage()+"]");
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