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