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,777 +22,794 @@ import java.util.Date; ...@@ -12,777 +22,794 @@ 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 {
private String userGstin;
private String supplyType;
private int subSupplyType;
private String docType;
private String docNo;
private String docDate;
private int transType;
private String fromGstin;
private String fromTrdName;
private String fromAddr1;
private String fromAddr2;
private String fromPlace;
private int fromPinCode;
private int fromStateCode;
private int actualFromStateCode;
private String toGstin;
private String toTrdName;
private String toAddr1;
private String toAddr2;
private String toPlace;
private int toPincode;
private int toStateCode;
private int actualToStateCode;
private double totalValue;
private double cgstValue;
private double sgstValue;
private double igstValue;
private double cessValue;
private int TotNonAdvolVal;
private int OthValue;
private double totInvValue;
private int transMode;
private double transDistance;
private String transporterName;
private String transporterId;
private String transDocNo;
private String transDocDate;
private String vehicleNo;
private String vehicleType; @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"})
private int mainHsnCode; public class EwayBillValue
private List<ItemDetails> itemList; {
public EwayBillValue(){ private String userGstin;
private String supplyType;
} private int subSupplyType;
private String docType;
/* public EwayBillValue(String userGstin, String supplyType, String subSupplyType, String docType, String docNo, private String docNo;
String docDate, String fromGstin, String fromTrdName, String formAddr1, String fromAddr2, String fromPlace, private String docDate;
int frompinCode, String fromstateCode, String actualFromStateCode, String toGstin, String toTrdName, private int transType;
String toAddr1, String toAddr2, String toPlace, int toPincode, String tostateCode, String actualToStateCode, private String fromGstin;
String assessable_value, double cgstValue, double sgstValue, double igstValue, double cessValue, private String fromTrdName;
double totalValue) { private String fromAddr1;
super(); private String fromAddr2;
this.userGstin = checkNull(userGstin); private String fromPlace;
this.supplyType = checkNull(supplyType); private int fromPinCode;
this.subSupplyType = checkNull(subSupplyType); private int fromStateCode;
this.docType = checkNull(docType); private int actualFromStateCode;
this.docNo = checkNull(docNo); private String toGstin;
this.docDate = checkNull(docDate); private String toTrdName;
this.fromGstin = checkNull(fromGstin); private String toAddr1;
this.fromTrdName = checkNull(fromTrdName); private String toAddr2;
this.formAddr1 = checkNull(formAddr1); private String toPlace;
this.fromAddr2 = checkNull(fromAddr2); private int toPincode;
this.fromPlace = checkNull(fromPlace); private int toStateCode;
this.frompinCode =frompinCode; private int actualToStateCode;
this.fromstateCode = checkNull(fromstateCode); private double totalValue;
this.actualFromStateCode = checkNull(actualFromStateCode); private double cgstValue;
this.toGstin = checkNull(toGstin); private double sgstValue;
this.toTrdName =checkNull(toTrdName); private double igstValue;
this.toAddr1 = checkNull(toAddr1); private double cessValue;
this.toAddr2 = checkNull(toAddr2); private int TotNonAdvolVal;
this.toPlace = checkNull(toPlace); private int OthValue;
this.toPincode = toPincode; private double totInvValue;
this.tostateCode = checkNull(tostateCode); private int transMode;
this.actualToStateCode = checkNull(actualToStateCode); private double transDistance;
this.cgstValue = cgstValue; private String transporterName;
this.sgstValue = sgstValue; private String transporterId;
this.igstValue = igstValue; private String transDocNo;
this.cessValue = cessValue; private String transDocDate;
this.totalValue = totalValue; private String vehicleNo;
}*/ private String vehicleType;
private int mainHsnCode;
public EwayBillValue(String userGstin, String supplyType, int subSupplyType, String docType, String docNo, private List<ItemDetails> itemList;
String docDate,int transType ,String fromGstin, String fromTrdName, String fromAddr1, String fromAddr2, String fromPlace, public EwayBillValue() {}
int frompinCode, int fromstateCode, int actualFromStateCode, String toGstin, String toTrdName,
String toAddr1, String toAddr2, String toPlace, int toPincode, int tostateCode, int actualToStateCode, 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)
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();
super(); this.supplyType = checkNull(supplyType).trim();
this.userGstin = checkNull(userGstin).trim(); this.subSupplyType = subSupplyType;
this.supplyType = checkNull(supplyType).trim(); this.docType = checkNull(docType).trim();
this.subSupplyType = subSupplyType; this.docNo = checkNull(docNo).trim();
this.docType = checkNull(docType).trim(); this.docDate = checkNull(docDate).trim();
this.docNo = checkNull(docNo).trim(); this.transType = transType;
this.docDate = checkNull(docDate).trim(); this.fromGstin = checkNull(fromGstin).trim();
this.transType =transType; this.fromTrdName = checkNull(fromTrdName).trim();
this.fromGstin = checkNull(fromGstin).trim(); this.fromAddr1 = checkNull(fromAddr1).trim();
this.fromTrdName = checkNull(fromTrdName).trim(); this.fromAddr2 = checkNull(fromAddr2).trim();
this.fromAddr1 = checkNull(fromAddr1).trim(); this.fromPlace = checkNull(fromPlace).trim();
this.fromAddr2 = checkNull(fromAddr2).trim(); fromPinCode = frompinCode;
this.fromPlace = checkNull(fromPlace).trim(); fromStateCode = fromstateCode;
this.fromPinCode =frompinCode; this.actualFromStateCode = actualFromStateCode;
this.fromStateCode = fromstateCode; this.toGstin = checkNull(toGstin);
this.actualFromStateCode = actualFromStateCode; this.toTrdName = checkNull(toTrdName).trim();
this.toGstin = checkNull(toGstin); this.toAddr1 = checkNull(toAddr1).trim();
this.toTrdName =checkNull(toTrdName).trim(); this.toAddr2 = checkNull(toAddr2).trim();
this.toAddr1 = checkNull(toAddr1).trim(); this.toPlace = checkNull(toPlace).trim();
this.toAddr2 = checkNull(toAddr2).trim(); this.toPincode = toPincode;
this.toPlace = checkNull(toPlace).trim(); toStateCode = tostateCode;
this.toPincode = toPincode; this.actualToStateCode = actualToStateCode;
this.toStateCode = tostateCode; totalValue = totalvalue;
this.actualToStateCode = actualToStateCode; this.cgstValue = cgstValue;
this.totalValue = totalvalue; this.sgstValue = sgstValue;
this.cgstValue = cgstValue; this.igstValue = igstValue;
this.sgstValue = sgstValue; this.cessValue = cessValue;
this.igstValue = igstValue; this.TotNonAdvolVal = TotNonAdvolVal;
this.cessValue = cessValue; this.OthValue = OthValue;
this.TotNonAdvolVal=TotNonAdvolVal; this.totInvValue = totInvValue;
this.OthValue=OthValue; this.transMode = transMode;
this.totInvValue = totInvValue; this.transDistance = transDistance;
this.transMode=transMode; this.transporterName = checkNull(transporterName).trim();
this.transDistance=transDistance; this.transporterId = checkNull(transporterId).trim();
this.transporterName=checkNull(transporterName).trim(); this.vehicleType = checkNull(vehicleType).trim();
this.transporterId=checkNull(transporterId).trim(); this.vehicleNo = checkNull(vehicleNo).trim();
this.vehicleType=checkNull(vehicleType).trim(); this.transDocDate = checkNull(transDocDate).trim();
this.vehicleNo=checkNull(vehicleNo).trim(); this.transDocNo = checkNull(transDocNo).trim();
this.transDocDate=checkNull(transDocDate).trim(); this.itemList = itemList;
this.transDocNo=checkNull(transDocNo).trim(); this.mainHsnCode = mainHsnCode;
this.itemList=itemList;
this.mainHsnCode=mainHsnCode; }
}
public String getUserGstin() { public String getUserGstin() { return userGstin; }
return userGstin;
} public void setUserGstin(String userGstin) {
public void setUserGstin(String userGstin) { this.userGstin = userGstin;
this.userGstin = userGstin; }
}
public String getSupplyType() { public String getSupplyType() { return supplyType; }
return supplyType;
} public void setSupplyType(String supplyType) {
public void setSupplyType(String supplyType) { this.supplyType = supplyType;
this.supplyType = supplyType; }
}
public int getSubSupplyType() { public int getSubSupplyType() { return subSupplyType; }
return subSupplyType;
} public void setSubSupplyType(int subSupplyType) {
public void setSubSupplyType(int subSupplyType) { this.subSupplyType = subSupplyType;
this.subSupplyType = subSupplyType; }
}
public String getDocType() { public String getDocType() { return docType; }
return docType;
} public void setDocType(String docType) {
public void setDocType(String docType) { this.docType = docType;
this.docType = docType; }
}
public String getDocNo() { public String getDocNo() { return docNo; }
return docNo;
} public void setDocNo(String docNo) {
public void setDocNo(String docNo) { this.docNo = docNo;
this.docNo = docNo; }
}
public String getDocDate() { public String getDocDate() { return docDate; }
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() { public String getFromGstin() { return fromGstin; }
return fromGstin;
} public void setFromGstin(String fromGstin) {
public void setFromGstin(String fromGstin) { this.fromGstin = fromGstin;
this.fromGstin = fromGstin; }
}
public String getFromTrdName() { public String getFromTrdName() { return fromTrdName; }
return fromTrdName;
} public void setFromTrdName(String fromTrdName) {
public void setFromTrdName(String fromTrdName) { this.fromTrdName = fromTrdName;
this.fromTrdName = fromTrdName; }
}
public String getFromAddr1() { public String getFromAddr1() { return fromAddr1; }
return fromAddr1;
} public void setFromAddr1(String fromAddr1) {
public void setFromAddr1(String fromAddr1) { this.fromAddr1 = fromAddr1;
this.fromAddr1 = fromAddr1; }
}
public String getFromAddr2() { public String getFromAddr2() { return fromAddr2; }
return fromAddr2;
} public void setFromAddr2(String fromAddr2) {
public void setFromAddr2(String fromAddr2) { this.fromAddr2 = fromAddr2;
this.fromAddr2 = fromAddr2; }
}
public String getFromPlace() { public String getFromPlace() { return fromPlace; }
return fromPlace;
} public void setFromPlace(String fromPlace) {
public void setFromPlace(String fromPlace) { this.fromPlace = fromPlace;
this.fromPlace = fromPlace; }
}
@JsonProperty("fromPinCode")
@JsonProperty("fromPinCode") public int getfromPinCode() {
public int getfromPinCode() { return fromPinCode;
return fromPinCode; }
}
@JsonProperty("fromPinCode")
@JsonProperty("fromPinCode") public void setfromPinCode(int fromPinCode) {
public void setfromPinCode(int fromPinCode) { this.fromPinCode = fromPinCode;
this.fromPinCode = fromPinCode; }
}
@JsonProperty("fromStateCode")
@JsonProperty("fromStateCode") public int getfromStateCode() {
public int getfromStateCode() { return fromStateCode;
return fromStateCode; }
}
@JsonProperty("fromStateCode")
@JsonProperty("fromStateCode") public void setfromStateCode(int fromStateCode) {
public void setfromStateCode(int fromStateCode) { this.fromStateCode = fromStateCode;
this.fromStateCode = fromStateCode; }
}
public int getActualFromStateCode() {
public int getActualFromStateCode() { return actualFromStateCode;
return actualFromStateCode; }
}
public void setActualFromStateCode(int actualFromStateCode) {
public void setActualFromStateCode(int actualFromStateCode) { this.actualFromStateCode = actualFromStateCode;
this.actualFromStateCode = actualFromStateCode; }
}
public String getToGstin() { public String getToGstin() { return toGstin; }
return toGstin;
} public void setToGstin(String toGstin) {
public void setToGstin(String toGstin) { this.toGstin = toGstin;
this.toGstin = toGstin; }
}
public String getToTrdName() { public String getToTrdName() { return toTrdName; }
return toTrdName;
} public void setToTrdName(String toTrdName) {
public void setToTrdName(String toTrdName) { this.toTrdName = toTrdName;
this.toTrdName = toTrdName; }
}
public String getToAddr1() { public String getToAddr1() { return toAddr1; }
return toAddr1;
} public void setToAddr1(String toAddr1) {
public void setToAddr1(String toAddr1) { this.toAddr1 = toAddr1;
this.toAddr1 = toAddr1; }
}
public String getToAddr2() { public String getToAddr2() { return toAddr2; }
return toAddr2;
} public void setToAddr2(String toAddr2) {
public void setToAddr2(String toAddr2) { this.toAddr2 = toAddr2;
this.toAddr2 = toAddr2; }
}
public String getToPlace() { public String getToPlace() { return toPlace; }
return toPlace;
} public void setToPlace(String toPlace) {
public void setToPlace(String toPlace) { this.toPlace = toPlace;
this.toPlace = toPlace; }
}
public int getToPincode() { public int getToPincode() { return toPincode; }
return toPincode;
} public void setToPincode(int toPincode) {
public void setToPincode(int toPincode) { this.toPincode = toPincode;
this.toPincode = toPincode; }
}
@JsonProperty("toStateCode")
@JsonProperty("toStateCode") public int getTostateCode() {
public int getTostateCode() { return toStateCode;
return toStateCode; }
}
@JsonProperty("toStateCode")
@JsonProperty("toStateCode") public void setTostateCode(int toStateCode) {
public void setTostateCode(int toStateCode) { this.toStateCode = toStateCode;
this.toStateCode = toStateCode; }
}
public int getActualToStateCode() { public int getActualToStateCode() { return actualToStateCode; }
return actualToStateCode;
} public void setActualToStateCode(int actualToStateCode) {
public void setActualToStateCode(int actualToStateCode) { this.actualToStateCode = actualToStateCode;
this.actualToStateCode = actualToStateCode; }
}
public double getCgstValue() { public double getCgstValue() { return cgstValue; }
return cgstValue;
} public void setCgstValue(double cgstValue) {
public void setCgstValue(double cgstValue) { this.cgstValue = cgstValue;
this.cgstValue = cgstValue; }
}
public double getSgstValue() { public double getSgstValue() { return sgstValue; }
return sgstValue;
} public void setSgstValue(double sgstValue) {
public void setSgstValue(double sgstValue) { this.sgstValue = sgstValue;
this.sgstValue = sgstValue; }
}
public double getIgstValue() { public double getIgstValue() { return igstValue; }
return igstValue;
} public void setIgstValue(double igstValue) {
public void setIgstValue(double igstValue) { this.igstValue = igstValue;
this.igstValue = igstValue; }
}
public double getCessValue() { public double getCessValue() { return cessValue; }
return cessValue;
} public void setCessValue(double cessValue) {
public void setCessValue(double cessValue) { this.cessValue = cessValue;
this.cessValue = cessValue; }
}
@JsonProperty("TotNonAdvolVal")
@JsonProperty("TotNonAdvolVal") public int getTotNonAdvolVal() {
public int getTotNonAdvolVal() { return TotNonAdvolVal;
return TotNonAdvolVal; }
}
@JsonProperty("TotNonAdvolVal")
@JsonProperty("TotNonAdvolVal") public void setTotNonAdvolVal(int TotNonAdvolVal) {
public void setTotNonAdvolVal(int TotNonAdvolVal) { this.TotNonAdvolVal = TotNonAdvolVal;
this.TotNonAdvolVal = TotNonAdvolVal; }
}
@JsonProperty("OthValue")
@JsonProperty("OthValue") public int getOthValue() {
public int getOthValue() { return OthValue;
return OthValue; }
}
@JsonProperty("OthValue")
@JsonProperty("OthValue") public void setOthValue(int OthValue) {
public void setOthValue(int OthValue) { this.OthValue = OthValue;
this.OthValue = OthValue; }
}
public double getTotalValue() {
public double getTotalValue() { return totalValue;
return totalValue; }
}
public void setTotalValue(double totalValue) { public void setTotalValue(double totalValue) { this.totalValue = totalValue; }
this.totalValue = totalValue;
}
public int getTransMode()
{
public int getTransMode() { return transMode;
return transMode; }
}
public void setTransMode(int transMode) {
public void setTransMode(int transMode) { this.transMode = transMode;
this.transMode = transMode; }
}
public String getTransporterName()
{
public String getTransporterName() { return transporterName;
return transporterName; }
}
public void setTransporterName(String transporterName) {
public void setTransporterName(String transporterName) { this.transporterName = transporterName;
this.transporterName = transporterName; }
}
public String getTransporterId()
{
public String getTransporterId() { return transporterId;
return transporterId; }
}
public void setTransporterId(String transporterId) {
public void setTransporterId(String transporterId) { this.transporterId = transporterId;
this.transporterId = transporterId; }
}
public String getVehicleType() {
public String getVehicleType() { return vehicleType;
return vehicleType; }
}
public void setVehicleType(String vehicleType) {
public void setVehicleType(String vehicleType) { this.vehicleType = vehicleType;
this.vehicleType = vehicleType; }
}
public String getVehicleNo() {
public String getVehicleNo() { return vehicleNo;
return vehicleNo; }
}
public void setVehicleNo(String vehicleNo) {
public void setVehicleNo(String vehicleNo) { this.vehicleNo = vehicleNo;
this.vehicleNo = vehicleNo; }
}
public String getTransDocNo() {
public String getTransDocNo() { return transDocNo;
return transDocNo; }
}
public void setTransDocNo(String transDocNo) {
public void setTransDocNo(String transDocNo) { this.transDocNo = transDocNo;
this.transDocNo = transDocNo; }
}
public String getTransDocDate() {
public String getTransDocDate() { return transDocDate;
return transDocDate; }
}
public void setTransDocDate(String transDocDate) {
public void setTransDocDate(String transDocDate) { this.transDocDate = transDocDate;
this.transDocDate = transDocDate; }
}
public int getMainHsnCode() {
public int getMainHsnCode() { return mainHsnCode;
return mainHsnCode; }
}
public void setMainHsnCode(int mainHsnCode) {
public void setMainHsnCode(int mainHsnCode) { this.mainHsnCode = mainHsnCode;
this.mainHsnCode = mainHsnCode; }
}
public double getTotInvValue() {
public double getTotInvValue() { return totInvValue;
return totInvValue; }
}
public void setTotInvValue(double totInvValue) {
public void setTotInvValue(double totInvValue) { this.totInvValue = totInvValue;
this.totInvValue = totInvValue; }
}
public double getTransDistance() {
public double getTransDistance() { return transDistance;
return transDistance; }
}
public void setTransDistance(double transDistance) {
public void setTransDistance(double transDistance) { this.transDistance = transDistance;
this.transDistance = transDistance; }
}
public List<ItemDetails> getItemList()
{
public List<ItemDetails> getItemList() { return itemList;
return itemList; }
}
public void setItemList(List<ItemDetails> itemList) {
public void setItemList(List<ItemDetails> itemList) { this.itemList = itemList;
this.itemList = itemList; }
}
public boolean validateFields(String refSer, String tranId, String siteCode,String logPath)//logPath added by nandkumar on 05/12/19
//add validations for the input values.... {
public boolean validateFields(String refSer,String tranId,String siteCode){ boolean flag = true;
try
String errorArray[]; {
boolean flag=true; System.out.println("Inside Validation Fields:" + docType);
try{ if (userGstin.trim().length() <= 0) {
System.out.println("Inside Validation Fields:"+ docType); String[] errorArray = getErrorMessageDescription("VTEW017").split(",");
if(userGstin.trim().length()<=0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW017").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW017-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW017-"+errorArray[1]+"'",siteCode); }
flag=false; if (docType.trim().length() <= 0) {
} String[] errorArray = getErrorMessageDescription("VTEW001").split(",");
}
if(docType.trim().length()<=0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW001").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW001-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW001-"+errorArray[1]+"'",siteCode); }
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) {
} String[] errorArray = getErrorMessageDescription("VTEW003").split(",");
}*/
if(fromGstin.trim().length()<=0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW003").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW003-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW003-"+errorArray[1]+"'",siteCode); }
flag=false; if (fromPinCode == 0) {
} String[] errorArray = getErrorMessageDescription("VTEW004").split(",");
}
if(fromPinCode==0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW004").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW004-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW004-"+errorArray[1]+"'",siteCode); }
flag=false; if (fromStateCode == 0) {
} String[] errorArray = getErrorMessageDescription("VTEW005").split(",");
}
if(fromStateCode==0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW005").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW005-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW005-"+errorArray[1]+"'",siteCode); }
flag=false; if (toStateCode == 0) {
} String[] errorArray = getErrorMessageDescription("VTEW006").split(",");
}
if(toStateCode==0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW006").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW006-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW006-"+errorArray[1]+"'",siteCode); }
flag=false; if (toGstin.trim().length() <= 0) {
} String[] errorArray = getErrorMessageDescription("VTEW007").split(",");
}
if(toGstin.trim().length()<=0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW007").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW007-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW007-"+errorArray[1]+"'",siteCode); }
flag=false; if (toPincode == 0) {
} String[] errorArray = getErrorMessageDescription("VTEW008").split(",");
}
if(toPincode==0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW008").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW008-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW008-"+errorArray[1]+"'",siteCode); }
flag=false; if ((transMode == 1) &&
} (transporterId.trim().length() <= 0) && (vehicleNo.trim().length() <= 0)) {
} String[] errorArray = getErrorMessageDescription("VTEW009").split(",");
if(transMode==1){
if(transporterId.trim().length()<=0 && vehicleNo.trim().length()<=0 ){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW009").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW009-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW009-"+errorArray[1]+"'",siteCode);
flag=false; errorArray = getErrorMessageDescription("VTEW011").split(",");
}
if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW011").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW011-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW011-"+errorArray[1]+"'",siteCode); }
flag=false;
}
} if (transMode != 1) {
} if (transDocDate.trim().length() <= 0) {
String[] errorArray = getErrorMessageDescription("VTEW010").split(",");
if(transMode != 1){
if(transDocDate.trim().length()<=0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW010").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW010-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW010-"+errorArray[1]+"'",siteCode); }
flag=false;
} if (docNo.trim().length() <= 0) {
} String[] errorArray = getErrorMessageDescription("VTEW002").split(",");
if(docNo.trim().length()<=0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW002").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW002-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW002-"+errorArray[1]+"'",siteCode); }
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) {
} String[] errorArray = getErrorMessageDescription("VTEW014").split(",");
}*/
if(transMode==0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW014").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW014-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW014-"+errorArray[1]+"'",siteCode); }
flag=false; if (transDistance == 0.0D) {
} String[] errorArray = getErrorMessageDescription("VTEW015").split(",");
}
if(transDistance==0.0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW015").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW015-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW015-"+errorArray[1]+"'",siteCode); }
flag=false; if (transDistance > 4000.0D) {
} String[] errorArray = getErrorMessageDescription("VTEW016").split(",");
}
if(transDistance>4000.00){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW016").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW016-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
if(errorArray[0].equals("E")){ }
printLog("EWAY Bill failed","'REF_SER-"+refSer+"','Tran-Id-"+tranId+"','Error-Code-VTEW016-"+errorArray[1]+"'",siteCode); }
flag=false;
}
}
Iterator<ItemDetails> itemListIterator = itemList.iterator();
while (itemListIterator.hasNext()) {
//checked values from the list where we add items. ItemDetails item = (ItemDetails)itemListIterator.next();
Iterator<ItemDetails> itemListIterator=itemList.iterator();
while(itemListIterator.hasNext()){ int value = item.getHsnCode();
ItemDetails item=itemListIterator.next(); System.out.println("hsn value:" + value);
int value=item.getHsnCode();
System.out.println("hsn value:"+value); if (value == 0) {
String[] errorArray = getErrorMessageDescription("VTEW012").split(",");
if(value==0){ if (errorArray[0].equals("E")) {
errorArray=getErrorMessageDescription("VTEW012").split(","); printLog("EWAY Bill failed", "'REF_SER-" + refSer + "','Tran-Id-" + tranId + "','Error-Code-VTEW012-" + errorArray[1] + "'", siteCode,logPath);
flag = false;
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,logPath);
} }
catch(Exception e){ return flag;
printLog("EWAY Bill failed",e.getMessage(),siteCode); }
}
return flag;
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 = "";
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(transDB);*/
String logFileName = "";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
logFileName = "EWAYBILL_" + siteCode + "_" + sdf.format(new Date());
System.out.println("Inside the print log method value");
// 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);
if (!logFileDir.exists())
{
logFileDir.mkdirs();
}
logFile = logDir + File.separator + logFileName + ".log";
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date now = new Date();
String strDate = sdfDate.format(now);
fileWriter = new FileWriter(logFile, true);
fileWriter.write("\r\n");
fileWriter.write(strDate + " " + "[ERROR] " + msg);
}
catch (Exception ex)
{
ex.printStackTrace();
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
{
conn.close();
conn = null;
}
catch (Exception localException2) {}*/
try
{
if (fileWriter != null)
{
fileWriter.flush();
fileWriter.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
String checkNull(String value) {
if (value == null) {
value = "";
}
return value;
}
public String getErrorMessageDescription(String errorCode)
throws RemoteException, ITMException
{
Statement stmt = null;
ResultSet rs = null;
Connection conn = null;
String msgType = "";
String msgString = "";
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();
String sqlQuery = "SELECT MSG_TYPE,MSG_STR,MSG_DESCR,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE FROM MESSAGES WHERE MSG_NO='" + errorCode + "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sqlQuery);
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
msgString = rs.getString("MSG_STR");
}
else
{
msgString = "Message Not Defined >>";
msgType = "E";
msgString = "";
}
stmt.close();
stmt = null;
rs.close();
rs = null;
}
catch (SQLException e)
{
System.out.println("Exception :EwaybillPrc :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception :EwaybillPrc :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
finally
{
try
{
conn.close();
conn = null;
}
catch (Exception localException1) {}
} }
return msgType + "," + msgString;
}
//printing the log values while validations }
\ No newline at end of file
private void printLog(String title, String msg,String siteCode)
{
String logFile = "";
String logDir = "";
File logFileDir = null;
FileWriter fileWriter = null;
String logPath="";
DistCommon distCommon = new DistCommon();
Connection conn = null;
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();
String logFileName = "";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
logFileName = "EWAYBILL_"+siteCode+"_"+sdf.format(new Date());
System.out.println("Inside the print log method");
logPath=distCommon.getDisparams("999999", "EWAY_LOG_PATH", conn);
logDir = logPath + File.separator + File.separator + "EWAYBILL";
System.out.println("Log direction: "+logDir);
logFileDir = new File(logDir);
if (!logFileDir.exists())
{
logFileDir.mkdirs();
}
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();
String strDate = sdfDate.format(now);
fileWriter = new FileWriter(logFile, true);
fileWriter.write("\r\n");
fileWriter.write(strDate+" "+"[ERROR] "+msg);
}
catch (Exception ex)
{
ex.printStackTrace();
//printLog("STDERR", ex);
printLog("STDOUT","Inside Exception [getLog]>>" + ex.toString(),siteCode);
}
finally
{
try
{
conn.close();
conn = null;
}
catch(Exception e){}
try
{
if (fileWriter != null)
{
fileWriter.flush();
fileWriter.close();
}
}
catch (Exception e)
{
e.printStackTrace();
//printLog("STDERR", e);
}
}
}
String checkNull(String value){
if(value==null){
value= "";
}
return value;
}
public String getErrorMessageDescription(String errorCode) throws RemoteException, ITMException
{
Statement stmt = null;
ResultSet rs = null;
Connection conn=null;
String msgType="";
String msgString="";
try{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB();
String sqlQuery = "SELECT MSG_TYPE,MSG_STR,MSG_DESCR,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE FROM MESSAGES WHERE MSG_NO='" + errorCode + "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sqlQuery);
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
msgString = rs.getString("MSG_STR");
}
else
{
msgString = "Message Not Defined >>";
msgType = "E";
msgString = "";
}
stmt.close();
stmt=null;
rs.close();
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);
}
catch (Exception e)
{
System.out.println("Exception :EwaybillPrc :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
finally
{
try
{
conn.close();
conn = null;
}
catch(Exception e){}
}
return msgType+","+msgString;
}
}
...@@ -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>");
xmlStringBuffer.append("<trans_doc_date>").append("<![CDATA[").append(todaysDate).append("]]>").append("</trans_doc_date>"); if(lrDate!=null)
xmlStringBuffer.append("<vehicle_no>").append("<![CDATA[").append("").append("]]>").append("</vehicle_no>"); {
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(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,23 +1469,43 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill ...@@ -1393,23 +1469,43 @@ 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
File file = new File(filePath+File.separator+filename+".json");//bring this path from disparm value
try{ try{
File fileFolder=new File(filePath+File.separator); 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");
} }
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; //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 //check for field validation..flag will returns the false value if any invalid details found
System.out.println("Validation List:"+validatorList); System.out.println("Validation List:"+validatorList);
...@@ -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" );
...@@ -2410,4 +2508,4 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill ...@@ -2410,4 +2508,4 @@ public class EwaybillPrc extends ProcessEJB implements EwaybillPrcLocal,Ewaybill
} }
} }
\ No newline at end of file
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