cleaned up, formatted and made the project runnable after decompilation
This commit is contained in:
commit
b90f70cb87
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
dependency-reduced-pom.xml
|
||||||
|
target/
|
69
pom.xml
Normal file
69
pom.xml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.main</groupId>
|
||||||
|
<artifactId>OutwardNeftInterface</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<exec.mainClass>com.main.ResponseMain</exec.mainClass>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20180130</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>1.2.17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.oracle.database.jdbc</groupId>
|
||||||
|
<artifactId>ojdbc8</artifactId>
|
||||||
|
<version>23.5.0.24.07</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<!-- not using Maven Compiler Plugin as it is not necessay -->
|
||||||
|
<!-- <plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
|
<configuration>
|
||||||
|
<release>1.8</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin> -->
|
||||||
|
|
||||||
|
<!-- Maven Shade plugin to build fat or uber jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<transformers>
|
||||||
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||||
|
<mainClass>com.main.ResponseMain</mainClass>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
158
src/main/java/com/bean/DataBean.java
Normal file
158
src/main/java/com/bean/DataBean.java
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
package com.bean;
|
||||||
|
|
||||||
|
public class DataBean {
|
||||||
|
private String trantype;
|
||||||
|
private String trandate;
|
||||||
|
private String utr;
|
||||||
|
private String bankcode;
|
||||||
|
private String trnamt;
|
||||||
|
private String jrnl;
|
||||||
|
private String sender_ifsc;
|
||||||
|
private String reciever_ifsc;
|
||||||
|
|
||||||
|
public String getTrantype() {
|
||||||
|
return this.trantype;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sender_acc_no;
|
||||||
|
private String recvr_acct_no;
|
||||||
|
private String reject_code;
|
||||||
|
private String reject_reason;
|
||||||
|
private String msg_type;
|
||||||
|
private String sndr_rcvr_info;
|
||||||
|
private String sender_name;
|
||||||
|
private String reciever_name;
|
||||||
|
private String beneficiary_address;
|
||||||
|
|
||||||
|
public void setTrantype(String trantype) {
|
||||||
|
this.trantype = trantype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTrandate() {
|
||||||
|
return this.trandate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrandate(String trandate) {
|
||||||
|
this.trandate = trandate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUtr() {
|
||||||
|
return this.utr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUtr(String utr) {
|
||||||
|
this.utr = utr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBankcode() {
|
||||||
|
return this.bankcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBankcode(String bankcode) {
|
||||||
|
this.bankcode = bankcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTrnamt() {
|
||||||
|
return this.trnamt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrnamt(String trnamt) {
|
||||||
|
this.trnamt = trnamt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJrnl() {
|
||||||
|
return this.jrnl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJrnl(String jrnl) {
|
||||||
|
this.jrnl = jrnl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender_ifsc() {
|
||||||
|
return this.sender_ifsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender_ifsc(String sender_ifsc) {
|
||||||
|
this.sender_ifsc = sender_ifsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReciever_ifsc() {
|
||||||
|
return this.reciever_ifsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReciever_ifsc(String reciever_ifsc) {
|
||||||
|
this.reciever_ifsc = reciever_ifsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender_acc_no() {
|
||||||
|
return this.sender_acc_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender_acc_no(String sender_acc_no) {
|
||||||
|
this.sender_acc_no = sender_acc_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecvr_acct_no() {
|
||||||
|
return this.recvr_acct_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecvr_acct_no(String recvr_acct_no) {
|
||||||
|
this.recvr_acct_no = recvr_acct_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReject_code() {
|
||||||
|
return this.reject_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReject_code(String reject_code) {
|
||||||
|
this.reject_code = reject_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReject_reason() {
|
||||||
|
return this.reject_reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReject_reason(String reject_reason) {
|
||||||
|
this.reject_reason = reject_reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg_type() {
|
||||||
|
return this.msg_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg_type(String msg_type) {
|
||||||
|
this.msg_type = msg_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSndr_rcvr_info() {
|
||||||
|
return this.sndr_rcvr_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSndr_rcvr_info(String sndr_rcvr_info) {
|
||||||
|
this.sndr_rcvr_info = sndr_rcvr_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender_name() {
|
||||||
|
return this.sender_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSender_name(String sender_name) {
|
||||||
|
this.sender_name = sender_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReciever_name() {
|
||||||
|
return this.reciever_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReciever_name(String reciever_name) {
|
||||||
|
this.reciever_name = reciever_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBeneficiary_address() {
|
||||||
|
return this.beneficiary_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBeneficiary_address(String beneficiary_address) {
|
||||||
|
this.beneficiary_address = beneficiary_address;
|
||||||
|
}
|
||||||
|
}
|
13
src/main/java/com/main/ResponseMain.java
Normal file
13
src/main/java/com/main/ResponseMain.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.main;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class ResponseMain {
|
||||||
|
static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
service.scheduleAtFixedRate(new Scheduler(), 0L, 30L, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
}
|
68
src/main/java/com/main/Scheduler.java
Normal file
68
src/main/java/com/main/Scheduler.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package com.main;
|
||||||
|
|
||||||
|
import com.methods.RequestResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Properties;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
public class Scheduler implements Runnable {
|
||||||
|
static Logger log = Logger.getLogger(Scheduler.class.getName());
|
||||||
|
public static Properties prop = new Properties();
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
InputStream input = null;
|
||||||
|
try {
|
||||||
|
input = Scheduler.class.getClass().getResourceAsStream("/Properties.properties");
|
||||||
|
|
||||||
|
prop.load(input);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
|
||||||
|
log.error(ex.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (input != null) {
|
||||||
|
try {
|
||||||
|
input.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error(
|
||||||
|
"Either no properties file found or error in properties file path in Scheduler class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
|
||||||
|
DateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
String dateToday = sdf.format(cal.getTime());
|
||||||
|
|
||||||
|
log.info("Inward Scheduled Run Begins...." + new Date());
|
||||||
|
try {
|
||||||
|
ArrayList<String> requestBodyList = RequestResponse.getRequestBody();
|
||||||
|
for (int i = 0; i < requestBodyList.size(); i++) {
|
||||||
|
|
||||||
|
log.info("Iterating for Next Bank API");
|
||||||
|
|
||||||
|
try {
|
||||||
|
RequestResponse.get_response(requestBodyList.get(i), dateToday);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(String.valueOf(e.getMessage()) + " for " + (String) requestBodyList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.error(String.valueOf(e.getMessage()) + " error in line no 78 scheduler class");
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("End of Scheduled Run");
|
||||||
|
}
|
||||||
|
}
|
937
src/main/java/com/methods/RequestResponse.java
Normal file
937
src/main/java/com/methods/RequestResponse.java
Normal file
@ -0,0 +1,937 @@
|
|||||||
|
package com.methods;
|
||||||
|
|
||||||
|
import com.bean.DataBean;
|
||||||
|
import com.main.Scheduler;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Properties;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class RequestResponse {
|
||||||
|
static Connection connection = null;
|
||||||
|
static ResultSet rs = null;
|
||||||
|
static Statement statement = null;
|
||||||
|
public static Properties prop = new Properties();
|
||||||
|
static Logger log = Logger.getLogger(Scheduler.class.getName());
|
||||||
|
|
||||||
|
public static ArrayList<DataBean> get_response(String jsonInputString, String date)
|
||||||
|
throws IOException {
|
||||||
|
int responseCode = -1;
|
||||||
|
String reverseTrandate = "";
|
||||||
|
InputStream input1 = null;
|
||||||
|
String apiURL = null;
|
||||||
|
try {
|
||||||
|
input1 = Scheduler.class.getClass().getResourceAsStream("/Properties.properties");
|
||||||
|
|
||||||
|
prop.load(input1);
|
||||||
|
apiURL = prop.getProperty("APIURL");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
|
||||||
|
log.error(String.valueOf(ex.getMessage()) + " error in request response class line no 67");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
if (input1 != null) {
|
||||||
|
try {
|
||||||
|
input1.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error(
|
||||||
|
"Either no properties file found or error in properties file path in request response"
|
||||||
|
+ " class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Req MSG : " + jsonInputString);
|
||||||
|
|
||||||
|
ArrayList<DataBean> data = new ArrayList<>();
|
||||||
|
ArrayList<DataBean> returndata = new ArrayList<>();
|
||||||
|
URL url = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
url = new URL(apiURL);
|
||||||
|
} catch (MalformedURLException e1) {
|
||||||
|
|
||||||
|
log.error(String.valueOf(e1.getMessage()) + " error in request response class on line no 96");
|
||||||
|
}
|
||||||
|
HttpURLConnection con = null;
|
||||||
|
try {
|
||||||
|
con = (HttpURLConnection) url.openConnection();
|
||||||
|
con.setRequestMethod("POST");
|
||||||
|
con.setRequestProperty("Content-Type", "application/json; utf-8");
|
||||||
|
con.setRequestProperty("Accept", "application/json");
|
||||||
|
con.setDoOutput(true);
|
||||||
|
|
||||||
|
} catch (IOException e2) {
|
||||||
|
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e2.getMessage()) + " error in request response class on line no 110");
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception exception1 = null, exception2 = null;
|
||||||
|
try {
|
||||||
|
OutputStream os = con.getOutputStream();
|
||||||
|
try {
|
||||||
|
byte[] input = jsonInputString.getBytes("utf-8");
|
||||||
|
os.write(input, 0, input.length);
|
||||||
|
} finally {
|
||||||
|
if (os != null) os.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
exception2 = null;
|
||||||
|
if (exception1 == null) {
|
||||||
|
exception1 = exception2;
|
||||||
|
} else if (exception1 != exception2) {
|
||||||
|
exception1.addSuppressed(exception2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Response Code : " + responseCode);
|
||||||
|
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||||
|
|
||||||
|
StringBuffer response = new StringBuffer();
|
||||||
|
response.append("{\"result\":");
|
||||||
|
try {
|
||||||
|
String inputLine;
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
response.append(inputLine);
|
||||||
|
}
|
||||||
|
} catch (IOException e1) {
|
||||||
|
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 139");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 145");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
response.append("}");
|
||||||
|
|
||||||
|
if (response.toString().contains("No data found")) {
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject(response.toString());
|
||||||
|
JSONObject errorobj = new JSONObject(json.get("result").toString());
|
||||||
|
|
||||||
|
String bankcode = errorobj.getString("bankcode");
|
||||||
|
String reason = errorobj.getString("reason");
|
||||||
|
String errordategetfromjson = errorobj.getString("trandate");
|
||||||
|
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date date2 = formatter1.parse(errordategetfromjson);
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(date2);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseIPKS(bankcode, reason, errordate, "CEDGE");
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into ipks database");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseAPI(bankcode, reason, errordate, "CEDGE");
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into API database");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (response.toString().contains("Unable to fetch data")) {
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject(response.toString());
|
||||||
|
JSONObject errorobj = new JSONObject(json.get("result").toString());
|
||||||
|
|
||||||
|
String bankcode = errorobj.getString("bankcode");
|
||||||
|
String reason = errorobj.getString("reason");
|
||||||
|
String errordategetfromjson = errorobj.getString("trandate");
|
||||||
|
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date date2 = formatter1.parse(errordategetfromjson);
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(date2);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseIPKS(bankcode, reason, errordate, "CEDGE");
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into ipks database");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseAPI(bankcode, reason, errordate, "CEDGE");
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into API database");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (response.toString().contains("SERVER UNAVAILABLE")) {
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject(response.toString());
|
||||||
|
JSONObject errorobj = new JSONObject(json.get("result").toString());
|
||||||
|
|
||||||
|
String bankcode = errorobj.getString("bankcode");
|
||||||
|
String reason = errorobj.getString("reason");
|
||||||
|
String errordategetfromjson = errorobj.getString("trandate");
|
||||||
|
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date date2 = formatter1.parse(errordategetfromjson);
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(date2);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseIPKS(bankcode, reason, errordate, "CEDGE");
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into ipks database");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseAPI(bankcode, reason, errordate, "CEDGE");
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into API database");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
System.out.println(response.toString());
|
||||||
|
JSONObject json = new JSONObject(response.toString());
|
||||||
|
JSONArray dataArray = new JSONArray(json.get("result").toString());
|
||||||
|
|
||||||
|
for (int i = 0; i < dataArray.length(); i++) {
|
||||||
|
|
||||||
|
String JSonData = dataArray.get(i).toString();
|
||||||
|
JSONObject dataD = new JSONObject(JSonData);
|
||||||
|
|
||||||
|
if (!dataD.getString("reject_reason").toString().trim().equalsIgnoreCase("")) {
|
||||||
|
|
||||||
|
System.out.println("yes");
|
||||||
|
|
||||||
|
DataBean databean = new DataBean();
|
||||||
|
databean.setTrantype(dataD.get("trantype").toString().trim());
|
||||||
|
databean.setBankcode(dataD.get("bankcode").toString().trim());
|
||||||
|
databean.setUtr(dataD.get("utr").toString().trim());
|
||||||
|
String Trandate = dataD.get("trandate").toString().trim();
|
||||||
|
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date date1 = formatter1.parse(Trandate);
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
reverseTrandate = dateFormat.format(date1);
|
||||||
|
databean.setTrandate(reverseTrandate);
|
||||||
|
databean.setJrnl(dataD.get("jrnl").toString().trim());
|
||||||
|
databean.setTrnamt(dataD.get("trnamt").toString().trim());
|
||||||
|
databean.setSender_ifsc(dataD.getString("sender_ifsc").toString().trim());
|
||||||
|
databean.setReciever_ifsc(dataD.getString("reciever_ifsc").toString().trim());
|
||||||
|
databean.setSender_acc_no(dataD.getString("sender_acc_no").toString().trim());
|
||||||
|
databean.setRecvr_acct_no(dataD.getString("recvr_acct_no").toString().trim());
|
||||||
|
databean.setReject_code(dataD.getString("reject_code").toString().trim());
|
||||||
|
databean.setReject_reason(dataD.getString("reject_reason").toString().trim());
|
||||||
|
databean.setMsg_type(dataD.getString("msg_type").toString().trim());
|
||||||
|
databean.setSndr_rcvr_info(dataD.getString("sndr_rcvr_info").toString().trim());
|
||||||
|
databean.setSender_name(dataD.getString("sender_name").toString().trim());
|
||||||
|
databean.setReciever_name(dataD.getString("reciever_name").toString().trim());
|
||||||
|
databean.setBeneficiary_address(
|
||||||
|
dataD.getString("beneficiary_address").toString().trim());
|
||||||
|
|
||||||
|
returndata.add(databean);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
System.out.println("no");
|
||||||
|
DataBean databean = new DataBean();
|
||||||
|
databean.setTrantype(dataD.get("trantype").toString().trim());
|
||||||
|
databean.setBankcode(dataD.get("bankcode").toString().trim());
|
||||||
|
databean.setUtr(dataD.get("utr").toString().trim());
|
||||||
|
String Trandate = dataD.get("trandate").toString().trim();
|
||||||
|
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date date1 = formatter1.parse(Trandate);
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
reverseTrandate = dateFormat.format(date1);
|
||||||
|
databean.setTrandate(reverseTrandate);
|
||||||
|
databean.setJrnl(dataD.get("jrnl").toString().trim());
|
||||||
|
databean.setTrnamt(dataD.get("trnamt").toString().trim());
|
||||||
|
databean.setSender_ifsc(dataD.getString("sender_ifsc").toString().trim());
|
||||||
|
databean.setReciever_ifsc(dataD.getString("reciever_ifsc").toString().trim());
|
||||||
|
databean.setSender_acc_no(dataD.getString("sender_acc_no").toString().trim());
|
||||||
|
databean.setRecvr_acct_no(dataD.getString("recvr_acct_no").toString().trim());
|
||||||
|
databean.setReject_code(dataD.getString("reject_code").toString().trim());
|
||||||
|
databean.setReject_reason(dataD.getString("reject_reason").toString().trim());
|
||||||
|
databean.setMsg_type(dataD.getString("msg_type").toString().trim());
|
||||||
|
databean.setSndr_rcvr_info(dataD.getString("sndr_rcvr_info").toString().trim());
|
||||||
|
databean.setSender_name(dataD.getString("sender_name").toString().trim());
|
||||||
|
databean.setReciever_name(dataD.getString("reciever_name").toString().trim());
|
||||||
|
databean.setBeneficiary_address(
|
||||||
|
dataD.getString("beneficiary_address").toString().trim());
|
||||||
|
|
||||||
|
data.add(databean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setDatainAPIDatabase(data, reverseTrandate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
String bankcode = "";
|
||||||
|
String reason = e.getMessage();
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(new Date());
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseAPI(bankcode, reason, errordate, "API");
|
||||||
|
} catch (Exception e2) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into API database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setDatainDatabase(data, reverseTrandate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
String bankcode = "";
|
||||||
|
String reason = e.getMessage();
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(new Date());
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseIPKS(bankcode, reason, errordate, "IPKS");
|
||||||
|
} catch (Exception e1) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into ipks database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returndata.isEmpty()) {
|
||||||
|
|
||||||
|
log.info("NO Return Found");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
try {
|
||||||
|
setReturnDatainAPIDatabase(returndata, reverseTrandate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
String bankcode = "", reason = e.getMessage();
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(new Date());
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseAPI(bankcode, reason, errordate, "API");
|
||||||
|
} catch (Exception e2) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into API database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
setReturnDatainDatabase(returndata, reverseTrandate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
String bankcode = "";
|
||||||
|
String reason = e.getMessage();
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
String errordate = dateFormat.format(new Date());
|
||||||
|
|
||||||
|
try {
|
||||||
|
ErrorStoreInDaatabaseIPKS(bankcode, reason, errordate, "IPKS");
|
||||||
|
} catch (Exception e1) {
|
||||||
|
|
||||||
|
log.info("Unable to add error log into ipks database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e3) {
|
||||||
|
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e3.getMessage()) + " error in request response class on line no 340");
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<String> getRequestBody() {
|
||||||
|
Date date = new Date();
|
||||||
|
|
||||||
|
DateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
String dateToday = sdf.format(cal.getTime());
|
||||||
|
|
||||||
|
log.info("Date :" + dateToday);
|
||||||
|
|
||||||
|
String url = null;
|
||||||
|
String bankCode = null;
|
||||||
|
ArrayList<String> finalUrl = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnection();
|
||||||
|
|
||||||
|
statement = connection.createStatement();
|
||||||
|
rs =
|
||||||
|
statement.executeQuery(
|
||||||
|
"select * from rupay_kcc_api_map where status='Y' and API_TYPE='TXN'");
|
||||||
|
while (rs.next()) {
|
||||||
|
url = rs.getString(8);
|
||||||
|
bankCode = rs.getString(6);
|
||||||
|
String finUrl = url.replaceAll("dt", dateToday);
|
||||||
|
finUrl = finUrl.replaceAll("bcode", bankCode);
|
||||||
|
finUrl = finUrl.replaceAll("tnty", "outwardneft");
|
||||||
|
finalUrl.add(finUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 375");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 382");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return finalUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ErrorStoreInDaatabaseIPKS(
|
||||||
|
String bankcode, String error_msg, String errordate, String Error_at) {
|
||||||
|
Connection connection = null;
|
||||||
|
|
||||||
|
Statement st = null;
|
||||||
|
String query = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnection();
|
||||||
|
st = connection.createStatement();
|
||||||
|
|
||||||
|
query =
|
||||||
|
"insert into neft_rtgs_dbtl_api_error_log"
|
||||||
|
+ " (bank_code,proc_date,proc_time,api_type,error_msg,error_at) values('"
|
||||||
|
+ bankcode
|
||||||
|
+ "','"
|
||||||
|
+ errordate
|
||||||
|
+ "',to_date(to_char(SYSTIMESTAMP,"
|
||||||
|
+ " 'DD-MON-RRHH24:MI:SS'),'DD-MON-RRHH24:MI:SS'),'OutNeft','"
|
||||||
|
+ error_msg
|
||||||
|
+ "','"
|
||||||
|
+ Error_at
|
||||||
|
+ "')";
|
||||||
|
|
||||||
|
st = connection.createStatement();
|
||||||
|
int i = st.executeUpdate(query);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(String.valueOf(e.getMessage()) + " error in request response class on line no 491");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 498 ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ErrorStoreInDaatabaseAPI(
|
||||||
|
String bankcode, String error_msg, String errordate, String Error_at) {
|
||||||
|
Connection connection = null;
|
||||||
|
|
||||||
|
Statement st = null;
|
||||||
|
String query = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnectionforAPI();
|
||||||
|
st = connection.createStatement();
|
||||||
|
|
||||||
|
query =
|
||||||
|
"insert into neft_rtgs_dbtl_api_error_log"
|
||||||
|
+ " (bank_code,proc_date,proc_time,api_type,error_msg,error_at) values('"
|
||||||
|
+ bankcode
|
||||||
|
+ "','"
|
||||||
|
+ errordate
|
||||||
|
+ "',to_date(to_char(SYSTIMESTAMP,"
|
||||||
|
+ " 'DD-MON-RRHH24:MI:SS'),'DD-MON-RRHH24:MI:SS'),'Dbtl','"
|
||||||
|
+ error_msg
|
||||||
|
+ "','"
|
||||||
|
+ Error_at
|
||||||
|
+ "')";
|
||||||
|
|
||||||
|
st = connection.createStatement();
|
||||||
|
int i = st.executeUpdate(query);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(String.valueOf(e.getMessage()) + " error in request response class on line no 524");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 531 ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDatainDatabase(ArrayList<DataBean> data, String date) {
|
||||||
|
Connection connection = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
Statement st = null;
|
||||||
|
String query = null;
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
ArrayList<String> combination = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnection();
|
||||||
|
st = connection.createStatement();
|
||||||
|
|
||||||
|
rs =
|
||||||
|
st.executeQuery(
|
||||||
|
"select l.bankcode,l.jrnl_id,l.tran_date from outward_neft_api_log l where"
|
||||||
|
+ " l.tran_date='"
|
||||||
|
+ date
|
||||||
|
+ "'");
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String comb =
|
||||||
|
String.valueOf(rs.getString(1)) + "|" + rs.getString(2) + "|" + rs.getString(3);
|
||||||
|
|
||||||
|
combination.add(comb);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 412");
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<DataBean> iter = data.iterator();
|
||||||
|
Statement st2 = connection.createStatement();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
DataBean d = iter.next();
|
||||||
|
|
||||||
|
if (combination.contains(
|
||||||
|
String.valueOf(d.getBankcode()) + "|" + d.getJrnl() + "|" + d.getTrandate())
|
||||||
|
|| d.getJrnl() == null
|
||||||
|
|| d.getJrnl().equalsIgnoreCase("")) {
|
||||||
|
log.info(
|
||||||
|
"RECORD ALREADY PRESENT IPKS for "
|
||||||
|
+ d.getBankcode()
|
||||||
|
+ "|"
|
||||||
|
+ d.getJrnl()
|
||||||
|
+ "|"
|
||||||
|
+ d.getTrandate());
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
query =
|
||||||
|
"insert into outward_neft_api_log(bankcode, jrnl_id, ref_no, tran_date,txn_amt,"
|
||||||
|
+ " recvr_acct_no, sender_acct_no, reciever_ifsc, sender_ifsc, sender_name,"
|
||||||
|
+ " reciever_name, beneficiary_address, sender_to_reciver_info, msg_type,"
|
||||||
|
+ " reject_code, reject_reason) values ('"
|
||||||
|
+ d.getBankcode()
|
||||||
|
+ "','"
|
||||||
|
+ d.getJrnl()
|
||||||
|
+ "','"
|
||||||
|
+ d.getUtr()
|
||||||
|
+ "','"
|
||||||
|
+ d.getTrandate()
|
||||||
|
+ "',("
|
||||||
|
+ d.getTrnamt()
|
||||||
|
+ "),'";
|
||||||
|
query =
|
||||||
|
String.valueOf(query)
|
||||||
|
+ d.getRecvr_acct_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_acc_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getBeneficiary_address()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSndr_rcvr_info()
|
||||||
|
+ "','"
|
||||||
|
+ d.getMsg_type()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReject_code()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReject_reason()
|
||||||
|
+ "')";
|
||||||
|
log.info("SQL Statement :" + query);
|
||||||
|
|
||||||
|
st2.addBatch(query);
|
||||||
|
log.info("Added to DB Insert Batch");
|
||||||
|
}
|
||||||
|
|
||||||
|
st2.executeBatch();
|
||||||
|
log.info("Insert to DB Completed");
|
||||||
|
log.info("Posting Txns in IPKS");
|
||||||
|
|
||||||
|
log.info("Posting Completed, Check log.");
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 459");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 466");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDatainAPIDatabase(ArrayList<DataBean> data, String date) {
|
||||||
|
Connection connection = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
Statement st = null;
|
||||||
|
String query = null;
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
ArrayList<String> bankCode = new ArrayList<>();
|
||||||
|
ArrayList<String> jrnl_id = new ArrayList<>();
|
||||||
|
ArrayList<String> txnDt = new ArrayList<>();
|
||||||
|
ArrayList<String> combination = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnectionforAPI();
|
||||||
|
st = connection.createStatement();
|
||||||
|
|
||||||
|
rs =
|
||||||
|
st.executeQuery(
|
||||||
|
"select l.bankcode,l.jrnl_id,l.tran_date from outward_neft_api_log l where"
|
||||||
|
+ " l.tran_date='"
|
||||||
|
+ date
|
||||||
|
+ "'");
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String comb =
|
||||||
|
String.valueOf(rs.getString(1)) + "|" + rs.getString(2) + "|" + rs.getString(3);
|
||||||
|
|
||||||
|
combination.add(comb);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 563");
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<DataBean> iter = data.iterator();
|
||||||
|
Statement st2 = connection.createStatement();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
DataBean d = iter.next();
|
||||||
|
|
||||||
|
if (combination.contains(
|
||||||
|
String.valueOf(d.getBankcode()) + "|" + d.getJrnl() + "|" + d.getTrandate())
|
||||||
|
|| d.getJrnl() == null
|
||||||
|
|| d.getJrnl().equalsIgnoreCase("")) {
|
||||||
|
log.info("RECORD ALREADY PRESENT");
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
query =
|
||||||
|
"insert into outward_neft_api_log(bankcode, jrnl_id, ref_no, tran_date,txn_amt,"
|
||||||
|
+ " recvr_acct_no, sender_acct_no, reciever_ifsc, sender_ifsc, sender_name,"
|
||||||
|
+ " reciever_name, beneficiary_address, sender_to_reciver_info, msg_type,"
|
||||||
|
+ " reject_code, reject_reason) values ('"
|
||||||
|
+ d.getBankcode()
|
||||||
|
+ "','"
|
||||||
|
+ d.getJrnl()
|
||||||
|
+ "','"
|
||||||
|
+ d.getUtr()
|
||||||
|
+ "','"
|
||||||
|
+ d.getTrandate()
|
||||||
|
+ "',("
|
||||||
|
+ d.getTrnamt()
|
||||||
|
+ "),'";
|
||||||
|
query =
|
||||||
|
String.valueOf(query)
|
||||||
|
+ d.getRecvr_acct_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_acc_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getBeneficiary_address()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSndr_rcvr_info()
|
||||||
|
+ "','"
|
||||||
|
+ d.getMsg_type()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReject_code()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReject_reason()
|
||||||
|
+ "')";
|
||||||
|
log.info("SQL Statement :" + query);
|
||||||
|
|
||||||
|
st2.addBatch(query);
|
||||||
|
log.info("Added to DB Insert Batch");
|
||||||
|
}
|
||||||
|
|
||||||
|
st2.executeBatch();
|
||||||
|
log.info("Insert to DB Completed");
|
||||||
|
log.info("Posting Txns in IPKS");
|
||||||
|
|
||||||
|
log.info("Posting Completed, Check log.");
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 610");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 617");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setReturnDatainDatabase(ArrayList<DataBean> data, String date) {
|
||||||
|
Connection connection = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
Statement st = null;
|
||||||
|
String query = null;
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
ArrayList<String> bankCode = new ArrayList<>();
|
||||||
|
ArrayList<String> jrnl_id = new ArrayList<>();
|
||||||
|
ArrayList<String> txnDt = new ArrayList<>();
|
||||||
|
ArrayList<String> combination = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnection();
|
||||||
|
st = connection.createStatement();
|
||||||
|
|
||||||
|
rs =
|
||||||
|
st.executeQuery(
|
||||||
|
"select l.bankcode,l.jrnl_id,l.txn_date from inward_neft_api_log l.txn_date='"
|
||||||
|
+ date
|
||||||
|
+ "'");
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String comb =
|
||||||
|
String.valueOf(rs.getString(1)) + "|" + rs.getString(2) + "|" + rs.getString(3);
|
||||||
|
|
||||||
|
combination.add(comb);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 743");
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<DataBean> iter = data.iterator();
|
||||||
|
Statement st2 = connection.createStatement();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
DataBean d = iter.next();
|
||||||
|
|
||||||
|
if (combination.contains(
|
||||||
|
String.valueOf(d.getBankcode()) + "|" + d.getJrnl() + "|" + d.getTrandate())
|
||||||
|
|| d.getJrnl() == null
|
||||||
|
|| d.getJrnl().equalsIgnoreCase("")) {
|
||||||
|
log.info("RECORD ALREADY PRESENT");
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
query =
|
||||||
|
"insert into inward_neft_api_log (bankcode,jrnl_id, ref_no, txn_date, txn_amt,"
|
||||||
|
+ " sender_ifsc, reciever_ifsc, sender_acct_no, sender_acct_name, remitter_detail,"
|
||||||
|
+ " remitter_info, recvr_acct_no, recvr_acct_name, status, reject_code,"
|
||||||
|
+ " reject_reason,msg_type) values ('"
|
||||||
|
+ d.getBankcode()
|
||||||
|
+ "','"
|
||||||
|
+ d.getJrnl()
|
||||||
|
+ "','"
|
||||||
|
+ d.getUtr()
|
||||||
|
+ "','"
|
||||||
|
+ d.getTrandate()
|
||||||
|
+ "',("
|
||||||
|
+ d.getTrnamt()
|
||||||
|
+ "),'"
|
||||||
|
+ d.getReciever_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getRecvr_acct_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_acc_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_name()
|
||||||
|
+ "','PROCESSED','"
|
||||||
|
+ d.getReject_code()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReject_reason()
|
||||||
|
+ "','N2R')";
|
||||||
|
log.info("SQL Statement :" + query);
|
||||||
|
|
||||||
|
st2.addBatch(query);
|
||||||
|
log.info("Added to DB Insert Batch");
|
||||||
|
}
|
||||||
|
|
||||||
|
st2.executeBatch();
|
||||||
|
log.info("Insert to DB Completed");
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 768");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 775");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setReturnDatainAPIDatabase(ArrayList<DataBean> data, String date) {
|
||||||
|
Connection connection = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
Statement st = null;
|
||||||
|
String query = null;
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
ArrayList<String> combination1 = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
connection = Util.getDBConnectionforAPI();
|
||||||
|
st = connection.createStatement();
|
||||||
|
|
||||||
|
rs =
|
||||||
|
st.executeQuery(
|
||||||
|
"select l.bankcode,l.jrnl_id,l.txn_date from inward_neft_api_log l.txn_date='"
|
||||||
|
+ date
|
||||||
|
+ "'");
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String comb =
|
||||||
|
String.valueOf(rs.getString(1)) + "|" + rs.getString(2) + "|" + rs.getString(3);
|
||||||
|
|
||||||
|
combination1.add(comb);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 806");
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<DataBean> iter = data.iterator();
|
||||||
|
Statement st2 = connection.createStatement();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
DataBean d = iter.next();
|
||||||
|
|
||||||
|
if (combination1.contains(
|
||||||
|
String.valueOf(d.getBankcode()) + "|" + d.getJrnl() + "|" + d.getTrandate())
|
||||||
|
|| d.getJrnl() == null
|
||||||
|
|| d.getJrnl().equalsIgnoreCase("")) {
|
||||||
|
log.info(
|
||||||
|
"RECORD ALREADY PRESENT API for "
|
||||||
|
+ d.getBankcode()
|
||||||
|
+ "|"
|
||||||
|
+ d.getJrnl()
|
||||||
|
+ "|"
|
||||||
|
+ d.getTrandate());
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
query =
|
||||||
|
"insert into inward_neft_api_log (bankcode,jrnl_id, ref_no, txn_date, txn_amt,"
|
||||||
|
+ " sender_ifsc, reciever_ifsc, sender_acct_no, sender_acct_name, remitter_detail,"
|
||||||
|
+ " remitter_info, recvr_acct_no, recvr_acct_name, status, reject_code,"
|
||||||
|
+ " reject_reason,msg_type) values ('"
|
||||||
|
+ d.getBankcode()
|
||||||
|
+ "','"
|
||||||
|
+ d.getJrnl()
|
||||||
|
+ "','"
|
||||||
|
+ d.getUtr()
|
||||||
|
+ "','"
|
||||||
|
+ d.getTrandate()
|
||||||
|
+ "',("
|
||||||
|
+ d.getTrnamt()
|
||||||
|
+ "),'"
|
||||||
|
+ d.getReciever_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_ifsc()
|
||||||
|
+ "','"
|
||||||
|
+ d.getRecvr_acct_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReciever_name()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_acc_no()
|
||||||
|
+ "','"
|
||||||
|
+ d.getSender_name()
|
||||||
|
+ "','PROCESSED','"
|
||||||
|
+ d.getReject_code()
|
||||||
|
+ "','"
|
||||||
|
+ d.getReject_reason()
|
||||||
|
+ "','N2R')";
|
||||||
|
|
||||||
|
st2.addBatch(query);
|
||||||
|
log.info("Added to DB Insert Batch");
|
||||||
|
}
|
||||||
|
|
||||||
|
st2.executeBatch();
|
||||||
|
log.info("Insert to DB Completed");
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(ex.getMessage()) + " error in request response class on line no 831");
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (connection != null) connection.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e1.getMessage()) + " error in request response class on line no 838");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
src/main/java/com/methods/Util.java
Normal file
43
src/main/java/com/methods/Util.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package com.methods;
|
||||||
|
|
||||||
|
import com.main.Scheduler;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
public class Util {
|
||||||
|
static Logger log = Logger.getLogger(Scheduler.class.getName());
|
||||||
|
|
||||||
|
public static Connection getDBConnection() {
|
||||||
|
Connection dbConnection = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName(Scheduler.prop.getProperty("DB_DRIVER"));
|
||||||
|
dbConnection =
|
||||||
|
DriverManager.getConnection(
|
||||||
|
Scheduler.prop.getProperty("DB_URL"),
|
||||||
|
Scheduler.prop.getProperty("DB_USER"),
|
||||||
|
Scheduler.prop.getProperty("DB_PWD"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(String.valueOf(e.getMessage()) + " in Util class db connection error");
|
||||||
|
}
|
||||||
|
return dbConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection getDBConnectionforAPI() {
|
||||||
|
Connection dbConnection = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName(Scheduler.prop.getProperty("DB_DRIVER"));
|
||||||
|
dbConnection =
|
||||||
|
DriverManager.getConnection(
|
||||||
|
Scheduler.prop.getProperty("DB_URL_API"),
|
||||||
|
Scheduler.prop.getProperty("DB_USER_API"),
|
||||||
|
Scheduler.prop.getProperty("DB_PWD_API"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(
|
||||||
|
String.valueOf(e.getMessage()) + " in Util class db connection error for API database");
|
||||||
|
}
|
||||||
|
return dbConnection;
|
||||||
|
}
|
||||||
|
}
|
14
src/main/resources/Properties.properties
Normal file
14
src/main/resources/Properties.properties
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#DB_URL=jdbc:oracle:thin:@localhost:1522:orcl
|
||||||
|
DB_URL=jdbc:oracle:thin:@ipksprod3.c7q7defafeea.ap-south-1.rds.amazonaws.com:1521:ipks
|
||||||
|
DB_DRIVER=oracle.jdbc.OracleDriver
|
||||||
|
#DB_USER=test
|
||||||
|
DB_USER=pacs_db
|
||||||
|
#DB_PWD=test
|
||||||
|
DB_PWD=pacs_db
|
||||||
|
#APIURL=https://uat.cedgenetbanking.in/IPKSTRAN
|
||||||
|
#APIURL=https://IPKS.cedgenetbanking.in/IPKSTRAN
|
||||||
|
APIURL=https://IPKS.cedgenetbanking.in/IPKSTRAN
|
||||||
|
|
||||||
|
DB_URL_API=jdbc:oracle:thin:@ipksapi.c7q7defafeea.ap-south-1.rds.amazonaws.com:1521:ipksapi
|
||||||
|
DB_USER_API=api_db
|
||||||
|
DB_PWD_API=api_db
|
9
src/main/resources/log4j.properties
Normal file
9
src/main/resources/log4j.properties
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Define the root logger with appender file
|
||||||
|
#log =C:/Users/PALTU BANERJEE/Downloads/eclipse-workspace/OutwardneftInterface
|
||||||
|
log=/home/ec2-user/NEFT_RTGS_DBT_LOGS/OUTWARD_NEFT
|
||||||
|
log4j.rootLogger=DEBUG, RollingAppender
|
||||||
|
log4j.appender.RollingAppender=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.RollingAppender.File=${log}/outwardneft.out
|
||||||
|
log4j.appender.RollingAppender.DatePattern='.'yyyy-MM-dd
|
||||||
|
log4j.appender.RollingAppender.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.RollingAppender.layout.ConversionPattern=[%p] %d %c %M - %m%n
|
Loading…
x
Reference in New Issue
Block a user