Commit 6e40c1a8 authored by ngadkari's avatar ngadkari

e-way bill

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@213254 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 465dfdda
package ibase.webitm.ejb.dis.adv;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.DBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.ITMException;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintStream;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.ResultSet;
......@@ -12,20 +22,56 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.ITMException;
/*
* This class will holds the values which will represents the EWAY BILL JSON FILE.
* This claas contains the validations for the various fields values of the eway json file.
*/
@JsonPropertyOrder({"userGstin","supplyType","subSupplyType","docType","docNo","docDate","transType","fromGstin","fromTrdName","fromAddr1","fromAddr2","fromPlace","fromPinCode","fromStateCode","actualFromStateCode","toGstin","toTrdName","toAddr1","toAddr2","toPlace","toPincode","toStateCode","actualToStateCode","totalValue","cgstValue","sgstValue","igstValue","cessValue","TotNonAdvolVal","OthValue","totInvValue","transMode","transDistance","transporterName","transporterId","transDocNo","transDocDate","vehicleNo","vehicleType","mainHsnCode","itemList"})
public class EwayBillValue {
@JsonPropertyOrder({"userGstin", "supplyType", "subSupplyType", "docType", "docNo", "docDate", "transType", "fromGstin", "fromTrdName", "fromAddr1", "fromAddr2", "fromPlace", "fromPinCode", "fromStateCode", "actualFromStateCode", "toGstin", "toTrdName", "toAddr1", "toAddr2", "toPlace", "toPincode", "toStateCode", "actualToStateCode", "totalValue", "cgstValue", "sgstValue", "igstValue", "cessValue", "TotNonAdvolVal", "OthValue", "totInvValue", "transMode", "transDistance", "transporterName", "transporterId", "transDocNo", "transDocDate", "vehicleNo", "vehicleType", "mainHsnCode", "itemList"})
public class EwayBillValue
{
private String userGstin;
private String supplyType;
private int subSupplyType;
......@@ -67,166 +113,124 @@ public class EwayBillValue {
private String vehicleType;
private int mainHsnCode;
private List<ItemDetails> itemList;
public EwayBillValue(){
}
/* public EwayBillValue(String userGstin, String supplyType, String subSupplyType, String docType, String docNo,
String docDate, String fromGstin, String fromTrdName, String formAddr1, String fromAddr2, String fromPlace,
int frompinCode, String fromstateCode, String actualFromStateCode, String toGstin, String toTrdName,
String toAddr1, String toAddr2, String toPlace, int toPincode, String tostateCode, String actualToStateCode,
String assessable_value, double cgstValue, double sgstValue, double igstValue, double cessValue,
double totalValue) {
super();
this.userGstin = checkNull(userGstin);
this.supplyType = checkNull(supplyType);
this.subSupplyType = checkNull(subSupplyType);
this.docType = checkNull(docType);
this.docNo = checkNull(docNo);
this.docDate = checkNull(docDate);
this.fromGstin = checkNull(fromGstin);
this.fromTrdName = checkNull(fromTrdName);
this.formAddr1 = checkNull(formAddr1);
this.fromAddr2 = checkNull(fromAddr2);
this.fromPlace = checkNull(fromPlace);
this.frompinCode =frompinCode;
this.fromstateCode = checkNull(fromstateCode);
this.actualFromStateCode = checkNull(actualFromStateCode);
this.toGstin = checkNull(toGstin);
this.toTrdName =checkNull(toTrdName);
this.toAddr1 = checkNull(toAddr1);
this.toAddr2 = checkNull(toAddr2);
this.toPlace = checkNull(toPlace);
this.toPincode = toPincode;
this.tostateCode = checkNull(tostateCode);
this.actualToStateCode = checkNull(actualToStateCode);
this.cgstValue = cgstValue;
this.sgstValue = sgstValue;
this.igstValue = igstValue;
this.cessValue = cessValue;
this.totalValue = totalValue;
}*/
public EwayBillValue(String userGstin, String supplyType, int subSupplyType, String docType, String docNo,
String docDate,int transType ,String fromGstin, String fromTrdName, String fromAddr1, String fromAddr2, String fromPlace,
int frompinCode, int fromstateCode, int actualFromStateCode, String toGstin, String toTrdName,
String toAddr1, String toAddr2, String toPlace, int toPincode, int tostateCode, int actualToStateCode,
double totalvalue, double cgstValue, double sgstValue, double igstValue, double cessValue,int TotNonAdvolVal,int OthValue, double totInvValue,
int transMode,double transDistance,String transporterName,String transporterId,String transDocNo,String transDocDate,String sundryType,String vehicleType,String vehicleNo,int mainHsnCode,List<ItemDetails> itemList,String refSer,String tranId) {
super();
public EwayBillValue() {}
public EwayBillValue(String userGstin, String supplyType, int subSupplyType, String docType, String docNo, String docDate, int transType, String fromGstin, String fromTrdName, String fromAddr1, String fromAddr2, String fromPlace, int frompinCode, int fromstateCode, int actualFromStateCode, String toGstin, String toTrdName, String toAddr1, String toAddr2, String toPlace, int toPincode, int tostateCode, int actualToStateCode, double totalvalue, double cgstValue, double sgstValue, double igstValue, double cessValue, int TotNonAdvolVal, int OthValue, double totInvValue, int transMode, double transDistance, String transporterName, String transporterId, String transDocNo, String transDocDate, String sundryType, String vehicleType, String vehicleNo, int mainHsnCode, List<ItemDetails> itemList, String refSer, String tranId)
{
this.userGstin = checkNull(userGstin).trim();
this.supplyType = checkNull(supplyType).trim();
this.subSupplyType = subSupplyType;
this.docType = checkNull(docType).trim();
this.docNo = checkNull(docNo).trim();
this.docDate = checkNull(docDate).trim();
this.transType =transType;
this.transType = transType;
this.fromGstin = checkNull(fromGstin).trim();
this.fromTrdName = checkNull(fromTrdName).trim();
this.fromAddr1 = checkNull(fromAddr1).trim();
this.fromAddr2 = checkNull(fromAddr2).trim();
this.fromPlace = checkNull(fromPlace).trim();
this.fromPinCode =frompinCode;
this.fromStateCode = fromstateCode;
fromPinCode = frompinCode;
fromStateCode = fromstateCode;
this.actualFromStateCode = actualFromStateCode;
this.toGstin = checkNull(toGstin);
this.toTrdName =checkNull(toTrdName).trim();
this.toTrdName = checkNull(toTrdName).trim();
this.toAddr1 = checkNull(toAddr1).trim();
this.toAddr2 = checkNull(toAddr2).trim();
this.toPlace = checkNull(toPlace).trim();
this.toPincode = toPincode;
this.toStateCode = tostateCode;
toStateCode = tostateCode;
this.actualToStateCode = actualToStateCode;
this.totalValue = totalvalue;
totalValue = totalvalue;
this.cgstValue = cgstValue;
this.sgstValue = sgstValue;
this.igstValue = igstValue;
this.cessValue = cessValue;
this.TotNonAdvolVal=TotNonAdvolVal;
this.OthValue=OthValue;
this.TotNonAdvolVal = TotNonAdvolVal;
this.OthValue = OthValue;
this.totInvValue = totInvValue;
this.transMode=transMode;
this.transDistance=transDistance;
this.transporterName=checkNull(transporterName).trim();
this.transporterId=checkNull(transporterId).trim();
this.vehicleType=checkNull(vehicleType).trim();
this.vehicleNo=checkNull(vehicleNo).trim();
this.transDocDate=checkNull(transDocDate).trim();
this.transDocNo=checkNull(transDocNo).trim();
this.itemList=itemList;
this.mainHsnCode=mainHsnCode;
}
public String getUserGstin() {
return userGstin;
this.transMode = transMode;
this.transDistance = transDistance;
this.transporterName = checkNull(transporterName).trim();
this.transporterId = checkNull(transporterId).trim();
this.vehicleType = checkNull(vehicleType).trim();
this.vehicleNo = checkNull(vehicleNo).trim();
this.transDocDate = checkNull(transDocDate).trim();
this.transDocNo = checkNull(transDocNo).trim();
this.itemList = itemList;
this.mainHsnCode = mainHsnCode;
}
public String getUserGstin() { return userGstin; }
public void setUserGstin(String userGstin) {
this.userGstin = userGstin;
}
public String getSupplyType() {
return supplyType;
}
public String getSupplyType() { return supplyType; }
public void setSupplyType(String supplyType) {
this.supplyType = supplyType;
}
public int getSubSupplyType() {
return subSupplyType;
}
public int getSubSupplyType() { return subSupplyType; }
public void setSubSupplyType(int subSupplyType) {
this.subSupplyType = subSupplyType;
}
public String getDocType() {
return docType;
}
public String getDocType() { return docType; }
public void setDocType(String docType) {
this.docType = docType;
}
public String getDocNo() {
return docNo;
}
public String getDocNo() { return docNo; }
public void setDocNo(String docNo) {
this.docNo = docNo;
}
public String getDocDate() {
return docDate;
}
public String getDocDate() { return docDate; }
public void setDocDate(String docDate) {
this.docDate = docDate;
}
@JsonProperty("transType")
public int gettransType() {
return transType;
}
public int gettransType() { return transType; }
@JsonProperty("transType")
public void settransType(int transType) {
this.transType = transType;
}
public String getFromGstin() {
return fromGstin;
}
public String getFromGstin() { return fromGstin; }
public void setFromGstin(String fromGstin) {
this.fromGstin = fromGstin;
}
public String getFromTrdName() {
return fromTrdName;
}
public String getFromTrdName() { return fromTrdName; }
public void setFromTrdName(String fromTrdName) {
this.fromTrdName = fromTrdName;
}
public String getFromAddr1() {
return fromAddr1;
}
public String getFromAddr1() { return fromAddr1; }
public void setFromAddr1(String fromAddr1) {
this.fromAddr1 = fromAddr1;
}
public String getFromAddr2() {
return fromAddr2;
}
public String getFromAddr2() { return fromAddr2; }
public void setFromAddr2(String fromAddr2) {
this.fromAddr2 = fromAddr2;
}
public String getFromPlace() {
return fromPlace;
}
public String getFromPlace() { return fromPlace; }
public void setFromPlace(String fromPlace) {
this.fromPlace = fromPlace;
}
......@@ -258,39 +262,39 @@ public class EwayBillValue {
public void setActualFromStateCode(int actualFromStateCode) {
this.actualFromStateCode = actualFromStateCode;
}
public String getToGstin() {
return toGstin;
}
public String getToGstin() { return toGstin; }
public void setToGstin(String toGstin) {
this.toGstin = toGstin;
}
public String getToTrdName() {
return toTrdName;
}
public String getToTrdName() { return toTrdName; }
public void setToTrdName(String toTrdName) {
this.toTrdName = toTrdName;
}
public String getToAddr1() {
return toAddr1;
}
public String getToAddr1() { return toAddr1; }
public void setToAddr1(String toAddr1) {
this.toAddr1 = toAddr1;
}
public String getToAddr2() {
return toAddr2;
}
public String getToAddr2() { return toAddr2; }
public void setToAddr2(String toAddr2) {
this.toAddr2 = toAddr2;
}
public String getToPlace() {
return toPlace;
}
public String getToPlace() { return toPlace; }
public void setToPlace(String toPlace) {
this.toPlace = toPlace;
}
public int getToPincode() {
return toPincode;
}
public int getToPincode() { return toPincode; }
public void setToPincode(int toPincode) {
this.toPincode = toPincode;
}
......@@ -304,33 +308,33 @@ public class EwayBillValue {
public void setTostateCode(int toStateCode) {
this.toStateCode = toStateCode;
}
public int getActualToStateCode() {
return actualToStateCode;
}
public int getActualToStateCode() { return actualToStateCode; }
public void setActualToStateCode(int actualToStateCode) {
this.actualToStateCode = actualToStateCode;
}
public double getCgstValue() {
return cgstValue;
}
public double getCgstValue() { return cgstValue; }
public void setCgstValue(double cgstValue) {
this.cgstValue = cgstValue;
}
public double getSgstValue() {
return sgstValue;
}
public double getSgstValue() { return sgstValue; }
public void setSgstValue(double sgstValue) {
this.sgstValue = sgstValue;
}
public double getIgstValue() {
return igstValue;
}
public double getIgstValue() { return igstValue; }
public void setIgstValue(double igstValue) {
this.igstValue = igstValue;
}
public double getCessValue() {
return cessValue;
}
public double getCessValue() { return cessValue; }
public void setCessValue(double cessValue) {
this.cessValue = cessValue;
}
......@@ -358,12 +362,12 @@ public class EwayBillValue {
public double getTotalValue() {
return totalValue;
}
public void setTotalValue(double totalValue) {
this.totalValue = totalValue;
}
public void setTotalValue(double totalValue) { this.totalValue = totalValue; }
public int getTransMode() {
public int getTransMode()
{
return transMode;
}
......@@ -371,8 +375,8 @@ public class EwayBillValue {
this.transMode = transMode;
}
public String getTransporterName() {
public String getTransporterName()
{
return transporterName;
}
......@@ -380,8 +384,8 @@ public class EwayBillValue {
this.transporterName = transporterName;
}
public String getTransporterId() {
public String getTransporterId()
{
return transporterId;
}
......@@ -445,8 +449,8 @@ public class EwayBillValue {
this.transDistance = transDistance;
}
public List<ItemDetails> getItemList() {
public List<ItemDetails> getItemList()
{
return itemList;
}
......@@ -455,224 +459,228 @@ public class EwayBillValue {
}
//add validations for the input values....
public boolean validateFields(String refSer,String tranId,String siteCode){
String errorArray[];
boolean flag=true;
try{
System.out.println("Inside Validation Fields:"+ docType);
public boolean validateFields(String refSer, String tranId, String siteCode,String logPath)//logPath added by nandkumar on 05/12/19
{
boolean flag = true;
try
{
System.out.println("Inside Validation Fields:" + docType);
if(userGstin.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW017").split(",");
if (userGstin.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW017").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW017-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW017-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(docType.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW001").split(",");
if (docType.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW001").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW001-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW001-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
/* if(docNo.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW002").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW002-"+errorArray[1]+"'");
flag=false;
}
}*/
if(fromGstin.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW003").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW003-"+errorArray[1]+"'",siteCode);
flag=false;
if (fromGstin.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW003").split(",");
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW003-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(fromPinCode==0){
errorArray=getErrorMessageDescription("VTEW004").split(",");
if (fromPinCode == 0) {
String[] errorArray = getErrorMessageDescription("VTEW004").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW004-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW004-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(fromStateCode==0){
errorArray=getErrorMessageDescription("VTEW005").split(",");
if (fromStateCode == 0) {
String[] errorArray = getErrorMessageDescription("VTEW005").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW005-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW005-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(toStateCode==0){
errorArray=getErrorMessageDescription("VTEW006").split(",");
if (toStateCode == 0) {
String[] errorArray = getErrorMessageDescription("VTEW006").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW006-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW006-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(toGstin.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW007").split(",");
if (toGstin.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW007").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW007-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW007-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(toPincode==0){
errorArray=getErrorMessageDescription("VTEW008").split(",");
if (toPincode == 0) {
String[] errorArray = getErrorMessageDescription("VTEW008").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW008-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW008-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(transMode==1){
if(transporterId.trim().length()<=0 && vehicleNo.trim().length()<=0 ){
errorArray=getErrorMessageDescription("VTEW009").split(",");
if ((transMode == 1) &&
(transporterId.trim().length() <= 0) && (vehicleNo.trim().length() <= 0)) {
String[] errorArray = getErrorMessageDescription("VTEW009").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW009-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW009-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
errorArray=getErrorMessageDescription("VTEW011").split(",");
errorArray = getErrorMessageDescription("VTEW011").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW011-"+errorArray[1]+"'",siteCode);
flag=false;
}
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW011-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(transMode != 1){
if(transDocDate.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW010").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW010-"+errorArray[1]+"'",siteCode);
flag=false;
if (transMode != 1) {
if (transDocDate.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW010").split(",");
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW010-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(docNo.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW002").split(",");
if (docNo.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW002").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW002-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW002-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
}
/* if(vehicleNo.trim().length()<=0){
errorArray=getErrorMessageDescription("VTEW011").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW011-"+errorArray[1]+"'");
flag=false;
}
}*/
if(transMode==0){
errorArray=getErrorMessageDescription("VTEW014").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW014-"+errorArray[1]+"'",siteCode);
flag=false;
if (transMode == 0) {
String[] errorArray = getErrorMessageDescription("VTEW014").split(",");
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW014-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(transDistance==0.0){
errorArray=getErrorMessageDescription("VTEW015").split(",");
if (transDistance == 0.0D) {
String[] errorArray = getErrorMessageDescription("VTEW015").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW015-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW015-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
if(transDistance>4000.00){
errorArray=getErrorMessageDescription("VTEW016").split(",");
if (transDistance > 4000.0D) {
String[] errorArray = getErrorMessageDescription("VTEW016").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW016-"+errorArray[1]+"'",siteCode);
flag=false;
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW016-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
}
}
//checked values from the list where we add items.
Iterator<ItemDetails> itemListIterator=itemList.iterator();
while(itemListIterator.hasNext()){
ItemDetails item=itemListIterator.next();
int value=item.getHsnCode();
System.out.println("hsn value:"+value);
Iterator<ItemDetails> itemListIterator = itemList.iterator();
while (itemListIterator.hasNext()) {
ItemDetails item = (ItemDetails)itemListIterator.next();
int value = item.getHsnCode();
System.out.println("hsn value:" + value);
if (value == 0) {
String[] errorArray = getErrorMessageDescription("VTEW012").split(",");
if (errorArray[0].equals("E")) {
printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW012-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(value==0){
errorArray=getErrorMessageDescription("VTEW012").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW012-"+errorArray[1]+"'",siteCode);
flag=false;
}
}
/*double taxableAmount=item.getTaxableAmount();
System.out.println("cgstValue:"+cgstValue+" igstValue:"+igstValue+" sgstValue:"+sgstValue+" taxableAmount:"+taxableAmount);
System.out.println("(cgstValue+igstValue+sgstValue+taxableAmount)"+(cgstValue+igstValue+sgstValue+taxableAmount)+" Invoice amount :"+(totInvValue)+"'");
if((cgstValue+igstValue+sgstValue+taxableAmount)<totInvValue)
{
errorArray=getErrorMessageDescription("VTEW013").split(",");
if(errorArray[0].equals("E")){
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW013-"+errorArray[1]);
flag=false;
}
}*/
}
}
catch(Exception e){
printLog("EWAY Bill failed",e.getMessage(),siteCode);
catch (Exception e)
{
printLog("EWAY Bill failed", e.getMessage(), siteCode,logPath);
}
return flag;
}
//printing the log values while validations
private void printLog(String title, String msg,String siteCode)
private void printLog(String title, String msg, String siteCode,String logPath)//logPath added by nandkumar gadkari on 05/12/19
{
String logFile = "";
String logDir = "";
File logFileDir = null;
FileWriter fileWriter = null;
String logPath="";
//String logPath = "";
DistCommon distCommon = new DistCommon();
Connection conn = null;
String loginCode="",transDB="";
try
{
/*E12GenericUtility genericUtility= new E12GenericUtility();
loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
DBAccessEJB dbAccess = new DBAccessEJB();//added by nandkumar gadkari on 05/12/19
UserInfoBean userInfo = dbAccess.createUserInfo(loginCode);//added by nandkumar gadkari on 05/12/19
transDB = userInfo.getTransDB();
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();
conn = connDriver.getConnectDB(transDB);*/
String logFileName = "";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
logFileName = "EWAYBILL_"+siteCode+"_"+sdf.format(new Date());
logFileName = "EWAYBILL_" + siteCode + "_" + sdf.format(new Date());
System.out.println("Inside the print log method");
System.out.println("Inside the print log method value");
logPath=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = logPath + File.separator + File.separator + "EWAYBILL";
System.out.println("Log direction: "+logDir);
// logPath = distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = CommonConstants.JBOSSHOME +File.separator+logPath + File.separator + File.separator + "EWAYBILL";
System.out.println("Log direction: " + logDir);
logFileDir = new File(logDir);
......@@ -684,28 +692,49 @@ public class EwayBillValue {
logFile = logDir + File.separator + logFileName + ".log";
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
java.util.Date now = new java.util.Date();
Date now = new Date();
String strDate = sdfDate.format(now);
fileWriter = new FileWriter(logFile, true);
fileWriter.write("\r\n");
fileWriter.write(strDate+" "+"[ERROR] "+msg);
fileWriter.write(strDate + " " + "[ERROR] " + msg);
}
catch (Exception ex)
{
ex.printStackTrace();
//printLog("STDERR", ex);
printLog("STDOUT","Inside Exception [getLog]>>" + ex.toString(),siteCode);
printLog("STDOUT", "Inside Exception [getLog]>>" + ex.toString(), siteCode,logPath);
/* try
{
conn.close();
conn = null;
}
catch (Exception localException1) {}*/
try
{
if (fileWriter != null)
{
fileWriter.flush();
fileWriter.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
finally
{
try
/*try
{
conn.close();
conn = null;
}
catch(Exception e){}
catch (Exception localException2) {}*/
try
{
if (fileWriter != null)
......@@ -717,28 +746,28 @@ public class EwayBillValue {
catch (Exception e)
{
e.printStackTrace();
//printLog("STDERR", e);
}
}
}
String checkNull(String value){
if(value==null){
value= "";
String checkNull(String value) {
if (value == null) {
value = "";
}
return value;
}
public String getErrorMessageDescription(String errorCode) throws RemoteException, ITMException
public String getErrorMessageDescription(String errorCode)
throws RemoteException, ITMException
{
Statement stmt = null;
ResultSet rs = null;
Connection conn=null;
String msgType="";
String msgString="";
try{
Connection conn = null;
String msgType = "";
String msgString = "";
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();
......@@ -757,13 +786,13 @@ public class EwayBillValue {
msgString = "";
}
stmt.close();
stmt=null;
stmt = null;
rs.close();
rs=null;
rs = null;
}
catch (SQLException e)
{
//printLog("E-way Bill Failed", "SQL Sytax is Incorrect for Ref-Ser :"+,"ERROR");
System.out.println("Exception :EwaybillPrc :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
......@@ -779,10 +808,8 @@ public class EwayBillValue {
conn.close();
conn = null;
}
catch(Exception e){}
catch (Exception localException1) {}
}
return msgType+","+msgString;
return msgType + "," + msgString;
}
}
\ No newline at end of file
......@@ -31,6 +31,8 @@ import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.EMail;
import ibase.utility.MailInfo;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.DBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.dis.DistCommon;
......@@ -48,6 +50,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
private String logDires="";
private List<Transaction> tranIdList=new ArrayList<Transaction>();
SimpleDateFormat sdf=null;
String logPathPrintL="";//added by nandkumar gadkari on 05/12/19
@Override
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams)
throws RemoteException, ITMException {
......@@ -125,11 +128,57 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
tranDateTo=genericUtility.getColumnValue("tran_date_to", dom2);
invValue=genericUtility.getColumnValue("inv_value", dom2);
supplyType=genericUtility.getColumnValue("state", dom2);
String lrNo="",lorryNo="",lrdateStr="";
Timestamp lrDate =null;
int cnt=0;
String gstnNo = "";
try
{
/*ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();*/
conn = getConnection();
//added by nandkumar gadkari on 05/12/19-
if(siteCode!=null && siteCode.trim().length()>0)
{
sql="select COUNT(*) from site where site_code= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs=pstmt.executeQuery();
if(rs.next())
{
cnt=rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt==0)
{
errString = itmDBAccessEJB.getErrorString("","VMSITE1",userId,"",conn);
return errString;
}
else
{
sql="select ddf_get_siteregno(?,'GSTIN_NO') AS GSTNNO from dual";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs=pstmt.executeQuery();
if(rs.next())
{
gstnNo=rs.getString("GSTNNO");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(gstnNo == null || gstnNo.trim().length() == 0 || gstnNo.equalsIgnoreCase("null"))
{
errString = itmDBAccessEJB.getErrorString("","VTEW017",userId,"",conn);
return errString;
}
}
}
//added by nandkumar gadkari on 05/12/19--end-----
xmlStringBuffer = new StringBuffer("<?xml version = \"1.0\"?>");
xmlStringBuffer.append("<DocumentRoot>");
xmlStringBuffer.append("<description>").append("Datawindow Root").append("</description>");
......@@ -216,7 +265,12 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
transMode=rs1.getString("trans_mode");
vehicleType=rs1.getString("vehicle_type");
transPorterName=rs1.getString("transporter_name");
//added by nandkumar gadkari on 05/12/19
lrNo=rs1.getString("LR_NO");
lrDate=rs1.getTimestamp("LR_DATE");
lorryNo=rs1.getString("LORRY_NO");
lrNo = lrNo==null ? "" :lrNo;
lorryNo= lorryNo== null ? "" :lorryNo;
xmlStringBuffer.append("<Detail2>");
xmlStringBuffer.append("<tran_ser>").append("<![CDATA[").append(tranSerRet).append("]]>").append("</tran_ser>");
xmlStringBuffer.append("<tran_date>").append("<![CDATA[").append(tranDate).append("]]>").append("</tran_date>");
......@@ -226,9 +280,16 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
//xmlStringBuffer.append("<to_place>").append("<![CDATA[").append(toPlace).append("]]>").append("</to_place>");
xmlStringBuffer.append("<trans_name>").append("<![CDATA[").append("").append("]]>").append("</trans_name>");
xmlStringBuffer.append("<trans_mode>").append("<![CDATA[").append(transMode==null?"R":transMode).append("]]>").append("</trans_mode>");
xmlStringBuffer.append("<trans_doc_id>").append("<![CDATA[").append("").append("]]>").append("</trans_doc_id>");
xmlStringBuffer.append("<trans_doc_id>").append("<![CDATA[").append(lrNo).append("]]>").append("</trans_doc_id>");
if(lrDate!=null)
{
xmlStringBuffer.append("<trans_doc_date>").append("<![CDATA[").append(sdf.format(lrDate)).append("]]>").append("</trans_doc_date>");
}
else
{
xmlStringBuffer.append("<trans_doc_date>").append("<![CDATA[").append(todaysDate).append("]]>").append("</trans_doc_date>");
xmlStringBuffer.append("<vehicle_no>").append("<![CDATA[").append("").append("]]>").append("</vehicle_no>");
}
xmlStringBuffer.append("<vehicle_no>").append("<![CDATA[").append(lorryNo).append("]]>").append("</vehicle_no>");
xmlStringBuffer.append("<distance>").append("<![CDATA[").append(distance).append("]]>").append("</distance>");
xmlStringBuffer.append("<invoice_amt>").append("<![CDATA[").append(invAmt).append("]]>").append("</invoice_amt>");
xmlStringBuffer.append("<assesable_value>").append("<![CDATA[").append(asseblValue).append("]]>").append("</assesable_value>");
......@@ -372,6 +433,8 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
refSer=genericUtility.getColumnValue("tran_ser", dom2);
tranId=genericUtility.getColumnValue("tran_id",dom2);
System.out.println("@ref ser:"+refSer+" @invoiceId:"+tranId);
DistCommon distCommon = new DistCommon();
logPathPrintL=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);//added by nandkumar gadkari on 05/12/19
loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
errString=executeGSTHdrAndGSTDetQuery(dom,dom2,xtraParams,conn);
......@@ -433,6 +496,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
String emailAddr="";
try{
DBAccessEJB dbAccess = new DBAccessEJB();//added by nandkumar gadkari on 05/12/19
E12GenericUtility genericUtility= new E12GenericUtility();
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
Timestamp currDateTs = new Timestamp(System.currentTimeMillis());
......@@ -470,7 +534,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
transDetailMap.put("vehicle_type", vehicleType);
transDetailMap.put("vehicle_no", vehicleNo);
dataList.add(transDetailMap);
errString=insertDataInGstHdrAndDetail(tranId,refSer,dataList, conn);
errString=insertDataInGstHdrAndDetail(tranId,refSer,dataList, conn,xtraParams);//xtraParams added by nandkumar on 05/12/19
System.out.println(genericUtility.getColumnValueFromNode("tran_id", detailNode));
}
catch(Exception e)
......@@ -531,8 +595,11 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
//logFilePath=new File(logDires+File.separator+mailLogFileName+".log");//Modified by Ahmed on 13/06/2019
try
{
UserInfoBean userInfo = dbAccess.createUserInfo(loginCode);//added by nandkumar gadkari on 05/12/19
FileUtils.copyFileToDirectory(logFilePath, copyLogFilePath);
mailSent= sendMailLog("",copyLogFilePath+File.separator+logFileNames+".log",getDomString(emailAddr),false);
System.out.println("copyFileToDirectory:"+(copyLogFilePath));
mailSent= sendMailLog("",copyLogFilePath+File.separator+logFileNames+".log",getDomString(emailAddr),false,userInfo);//userInfo added by nandkumar gadkari on 05/12/19
//mailSent= sendMailLog("",copyLogFilePath+File.separator+mailLogFileName+".log",getDomString(emailAddr),false);//Modified by Ahmed on 13/06/2019
if(mailSent)
{
......@@ -546,6 +613,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
catch(Exception e)
{
System.out.println("failure while sending the mail EXCEPTION ");
e.printStackTrace();
}
}
......@@ -595,7 +663,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
return errString;
}
public String insertDataInGstHdrAndDetail(String tranId,String refSer,ArrayList list,Connection conn)throws RemoteException, ITMException
public String insertDataInGstHdrAndDetail(String tranId,String refSer,ArrayList list,Connection conn,String xtraParams)throws RemoteException, ITMException
{
String errString="";
String sql="";
......@@ -865,15 +933,16 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
pstmt2=null;
returnHdr++;
System.out.println("returnHdr::::"+returnHdr);
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
if(returnHdr<=0){
/*if(returnHdr<=0){
printLog("E-way Bill Failed", "No Data Found for Inserting in GST HEADER details for Transaction Id:"+tranId,"ERROR");
}
}*/
}
/*sql="insert into GST_DATA_HDR(tran_id,tran_date,tran_id__ref,site_code,prd_code,rec_type,"
......@@ -889,7 +958,9 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
rs=null;
pstmt.close();
pstmt=null;
if(returnHdr<=0){
printLog("E-way Bill Failed", "No Data Found for Inserting in GST HEADER details for Transaction Id:"+tranId,"ERROR");
}
//DETAIL BLOCKS START FROM HERE....
if(returnHdr>0)
......@@ -1009,7 +1080,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
errString="VTEPFAIL";
}
else{
if(validateJSONFileForEway(transaction,site_code,conn)){
if(validateJSONFileForEway(transaction,site_code,conn,xtraParams)){//xtraParams added bu nandkumar on 05/12/19
tranIdList.add(transaction);
conn.commit();
}
......@@ -1131,7 +1202,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
File logFilePath=null;
File copyFilePath=null;
File copyLogFilePath=null;
String loginCode="";
//String loginCode="";
String transInfo="";
String emailAddr="";
boolean mailSent;
......@@ -1141,6 +1212,8 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
try{
E12GenericUtility genericUtility= new E12GenericUtility();
DBAccessEJB dbAccess = new DBAccessEJB();//added by nandkumar gadkari on 05/12/19
UserInfoBean userInfo = dbAccess.createUserInfo(loginCode);//added by nandkumar gadkari on 05/12/19
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
Timestamp currDateTs = new Timestamp(System.currentTimeMillis());
//getting date format for ewaybill
......@@ -1365,7 +1438,10 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
catch(Exception e)
{
System.out.println("counter JSON FILE exception");
e.printStackTrace();
throw new ITMException(e);
}
}
if(rs!=null){
......@@ -1393,22 +1469,42 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
String filename=siteCode+"_"+count;
ObjectMapper mapper = new ObjectMapper();
//added by nandkumar
try{
File fileFolder=new File( CommonConstants.JBOSSHOME +File.separator+filePath+File.separator);// CommonConstants.JBOSSHOME + added by nandkumar gadkari on 05/12/19
//check for file validation...this will check the provided file path is correct or not
if (! fileFolder.exists()){
/*errString="VTEPFAIL";
printLog("E-way Bill Failed", "Provided File Path is Incorrect ","ERROR");
con.rollback();
return errString;*/ //commneted by nandkumar gadkari on 05/12/19
printLog("E-way Bill Failed", "Provided File Path is Incorrect ","ERROR");
fileFolder.mkdirs();
File file = new File(filePath+File.separator+filename+".json");//bring this path from disparm value
}
}
catch(Exception e){
printLog("E-way Bill Failed", "Provided File Path is Incorrect ","ERROR");
}
try{
File fileFolder=new File(filePath+File.separator);
File file = new File( CommonConstants.JBOSSHOME +File.separator+filePath+File.separator+filename+".json");//bring this path from disparm value// CommonConstants.JBOSSHOME + added by nandkumar gadkari on 05/12/19
/*try{
File fileFolder=new File( CommonConstants.JBOSSHOME +File.separator+filePath+File.separator);// CommonConstants.JBOSSHOME + added by nandkumar gadkari on 05/12/19
//check for file validation...this will check the provided file path is correct or not
if (! fileFolder.exists()){
errString="VTEPFAIL";
printLog("E-way Bill Failed", "Provided File Path is Incorrect ","ERROR");
con.rollback();
return errString;
return errString; //commneted by nandkumar gadkari on 05/12/19
printLog("E-way Bill Failed", "Provided File Path is Incorrect ","ERROR");
fileFolder.mkdirs();
}
}
catch(Exception e){
printLog("E-way Bill Failed", "Provided File Path is Incorrect ","ERROR");
}
}*/// commented by nandkumar gadkari on 05/12/19
//check for field validation..flag will returns the false value if any invalid details found
......@@ -1476,7 +1572,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
if(emailAddr!=null && emailAddr.trim().length()>0){
transInfo = getDomString(emailAddr);
copyFilePath = new File(filePath + File.separator +"temp");
copyFilePath = new File(CommonConstants.JBOSSHOME +File.separator+filePath + File.separator +"temp");//CommonConstants.JBOSSHOME + added by nandkumar gadkari on 05/12/19
if(!copyFilePath.exists()) {
copyFilePath.mkdir();
}
......@@ -1493,7 +1589,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
//log file
copyLogFilePath = new File(logDires + File.separator +"temp");
copyLogFilePath = new File(CommonConstants.JBOSSHOME +File.separator+logDires + File.separator +"temp");
if(!copyLogFilePath.exists()) {
copyLogFilePath.mkdir();
}
......@@ -1516,7 +1612,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
if(filename != null && filename.trim().length() > 0)
{
orgFilePath=new File(filePath+File.separator+filename+".json");
orgFilePath=new File(CommonConstants.JBOSSHOME +File.separator+filePath+File.separator+filename+".json");
FileUtils.copyFileToDirectory(orgFilePath, copyFilePath);
......@@ -1525,7 +1621,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
FileUtils.copyFileToDirectory(logFilePath, copyLogFilePath);*/
//send JSon File....
mailSent= sendMail("",copyFilePath+File.separator+filename+".json",transInfo,true);
mailSent= sendMail("",copyFilePath+File.separator+filename+".json",transInfo,true,userInfo);//userInfo added by nandkumar gadkari on 05/12/19
if(mailSent){
printMailLog("JSON file Mail Send succesfully to "+emailAddr, "Mail Send Successfully!"+refSer,"SUCCESS");
......@@ -1554,12 +1650,12 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
//send mail for log file
logFilePath=new File(logDires+File.separator+logFileNames+".log");
logFilePath=new File(CommonConstants.JBOSSHOME +logDires+File.separator+logFileNames+".log");
//logFilePath=new File(logDires+File.separator+mailLogFileName+".log");
try{
FileUtils.copyFileToDirectory(logFilePath, copyLogFilePath);
mailSent= sendMailLog("",copyLogFilePath+File.separator+logFileNames+".log",transInfo,false);
mailSent= sendMailLog("",copyLogFilePath+File.separator+logFileNames+".log",transInfo,false,userInfo);//userInfo added by nandkumar gadkari on 05/12/19
//mailSent= sendMailLog("",copyLogFilePath+File.separator+mailLogFileName+".log",transInfo,false);
if(mailSent){
......@@ -1609,7 +1705,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
public boolean validateJSONFileForEway(Transaction tranId,String siteCode,Connection con)throws RemoteException, ITMException{
public boolean validateJSONFileForEway(Transaction tranId,String siteCode,Connection con,String xtraParams)throws RemoteException, ITMException{
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null ;
......@@ -1740,7 +1836,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
{
//getting data from GST HDR and GST DET tables for generating the JSON file for EWAY
//from detail part
System.out.println("inside the loop of EWAY JSON file");
System.out.println("inside the loop of EWAYJ JSON file");
if(!temp.equalsIgnoreCase(rs1.getString("ref_id"))){
itemList=new ArrayList<ItemDetails>();
......@@ -1822,14 +1918,14 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
fromAddr1,fromAddr2,fromPlace,frompinCode,fromstateCode,actualFromStateCode,
toGstin,toTrdName,toAddr1,toAddr2,toPlace,toPincode,tostateCode,actualToStateCode,totalAssesableValue,
cgstValue,sgstValue,igstValue,cessValue,0,0,totInvValue,transMode,transDistance,transporterName,transporterid,transDocNo,transactionDocDate,sundryType,vehicleType,vehicleNo,mainHsnCode,itemList,refSer,refId);
//xtraParams added by nandkumar on 05/12/19
if(temp.equalsIgnoreCase(refId)){
list.remove(list.size()-1);
}
list.add(ewayBillValue);
flag=ewayBillValue.validateFields(refSer, refId,siteCode);
logPath = distCommon.getDisparams("999999", "EWAY_LOG_PATH", con);//ADDED BY NANDKUMAR GADKARI ON05/12/19
flag=ewayBillValue.validateFields(refSer, refId,siteCode,logPath);
System.out.println("Validation flag is:"+flag);
System.out.println("counter:"+valueCounter+" Size ValueList:"+list.size());
temp=rs1.getString("ref_id");
......@@ -1849,15 +1945,16 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
catch(Exception e)
{
e.printStackTrace();
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
catch (SQLException e)
{
......@@ -2034,7 +2131,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
System.out.println("Inside the print log method");
logPath=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = logPath + File.separator + "EWAYBILL";
logDir = CommonConstants.JBOSSHOME +File.separator+logPath + File.separator + "EWAYBILL"; //CommonConstants.JBOSSHOME + added by nandkumar
System.out.println("Log direction: "+logDir);
logFileDir = new File(logDir);
......@@ -2044,7 +2141,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
logFileDir.mkdirs();
}
logFile = logDir + File.separator + logFileName + ".log";
logFile = CommonConstants.JBOSSHOME +File.separator+logDir + File.separator + logFileName + ".log";
logFileNames=logFileName;
logDires=logDir;
......@@ -2069,20 +2166,21 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
FileWriter fileWriter = null;
String logPath="";
DistCommon distCommon = new DistCommon();
Connection conn = null;
//Connection conn = null;
try
{
/*ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();*/
conn = getConnection();
//conn = getConnection();/ commented by nandkumar gadkari on 05/12/19
logPath=logPathPrintL;//added by nandkumar gadkari on 05/12/19
String logFileName = "";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
logFileName = "EWAYBILL_"+siteCodes+"_"+sdf.format(new Date());
System.out.println("Inside the print log method");
logPath=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = logPath + File.separator + "EWAYBILL";
//logPath=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = CommonConstants.JBOSSHOME +File.separator+logPath + File.separator + "EWAYBILL";
System.out.println("Log direction: "+logDir);
logFileDir = new File(logDir);
......@@ -2092,7 +2190,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
logFileDir.mkdirs();
}
logFile = logDir + File.separator + logFileName + ".log";
logFile = CommonConstants.JBOSSHOME +File.separator+logDir + File.separator + logFileName + ".log";
logFileNames=logFileName;
logDires=logDir;
......@@ -2110,14 +2208,14 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
{
ex.printStackTrace();
//printLog("STDERR", ex);
printLog("STDOUT","Inside Exception [getLog]>>" + ex.toString(),"ERROR");
// printLog("STDOUT","Inside Exception [getLog]>>" + ex.toString(),"ERROR");
}
finally
{
try
{
conn.close();
conn = null;
/*conn.close();
conn = null;*/
}
catch(Exception e){}
try
......@@ -2158,7 +2256,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
System.out.println("Inside the print log method");
logPath=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = logPath + File.separator + "EWAYBILL";
logDir = CommonConstants.JBOSSHOME +File.separator+logPath + File.separator + "EWAYBILL";
System.out.println("Log direction: "+logDir);
logFileDir = new File(logDir);
......@@ -2168,7 +2266,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
logFileDir.mkdirs();
}
logFile = logDir + File.separator + logFileName + ".log";
logFile = CommonConstants.JBOSSHOME +File.separator+logDir + File.separator + logFileName + ".log";
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
java.util.Date now = new java.util.Date();
......@@ -2233,7 +2331,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
//send email id option...
private boolean sendMail(String jsonFilePath,String attachment, String transInfo,boolean flag)throws ITMException
private boolean sendMail(String jsonFilePath,String attachment, String transInfo,boolean flag,UserInfoBean userInfo)throws ITMException//UserInfoBean userInfo added by nandkumar gadkari
{
boolean sentMail = false;
......@@ -2288,7 +2386,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
System.out.println("@@## [Generic Report] :sendMail mailDomStr :-->" + mailDomStr);
EMail email = new EMail();
MailInfo info=new MailInfo();
retValue=email.sendMail(mailDomStr, "ITM");
retValue=email.sendMail(mailDomStr, "ITM",userInfo);// userInfo
if("S".equalsIgnoreCase(retValue))
{
//printLog("STDOUT","ReportCreationScheduler : sendMail => Mail sent successfully" );
......@@ -2310,7 +2408,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
}
//send mail log files...
private boolean sendMailLog(String jsonFilePath,String attachment, String transInfo,boolean flag)throws ITMException
private boolean sendMailLog(String jsonFilePath,String attachment, String transInfo,boolean flag ,UserInfoBean userInfo)throws ITMException //UserInfoBean userInfo added by nandkumar gadkari
{
boolean sentMail = false;
......@@ -2365,7 +2463,7 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
System.out.println("@@## [Generic Report] :sendMail mailDomStr :-->" + mailDomStr);
EMail email = new EMail();
MailInfo info=new MailInfo();
retValue=email.sendMail(mailDomStr, "ITM");
retValue=email.sendMail(mailDomStr, "ITM",userInfo);// userInfo
if("S".equalsIgnoreCase(retValue))
{
//printLog("STDOUT","ReportCreationScheduler : sendMail => Mail sent successfully" );
......
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