Added new modification
This commit is contained in:
parent
99789f78a4
commit
3ce4d952ce
@ -46,15 +46,13 @@ public class TDS_Calculation {
|
||||
|
||||
//Calculate the Projected value and insert into the table TDS_TXN
|
||||
for (Map<String, Object> accountDetails : depAccountsDetails) {
|
||||
String accNo = (String) accountDetails.get("KEY_1");
|
||||
Double INTT_PROJECTED = (Double) accountDetails.get(("INTT_PROJECTED"));
|
||||
System.out.println("Interest Paid:" + INTT_PROJECTED);
|
||||
String INTT_PAYOUT_FREQ = (String) accountDetails.get("INTT_PAYOUT_FREQ");
|
||||
System.out.println("INTT_PAYOUT_FREQ:" + INTT_PAYOUT_FREQ);
|
||||
double ProjectedAmt = calculateProjectedAmount(accountDetails);
|
||||
System.out.println("Projected amount for the account:" + accNo + " " + ProjectedAmt);
|
||||
String prodCode = (String) accountDetails.get("PROD_CODE");
|
||||
insertProjectedAmount(accNo, ProjectedAmt, prodCode);
|
||||
//String accNo = (String) accountDetails.get("KEY_1");
|
||||
|
||||
//Caclculate the Projected amount.
|
||||
calculateProjectedAmount(accountDetails);
|
||||
//System.out.println("Projected amount for the account:" + accNo + " " + ProjectedAmt);
|
||||
|
||||
//insertProjectedAmount(accNo, ProjectedAmt, prodCode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -68,7 +66,7 @@ public class TDS_Calculation {
|
||||
+ "DA.INTT_PAID,DP.PROD_CODE,DA.INTT_SOP_DATE,DA.INTT_EOP_DATE,DA.TERM_VALUE,DA.MAT_VALUE,DA.MAT_DT,DA.TERM_LENGTH,\n"
|
||||
+ "DA.NXT_DUE_DATE,DA.INTT_PROJECTED,dp.INTT_PAYOUT_FREQ FROM DEP_ACCOUNT DA ,dep_product dp\n"
|
||||
+ "where DA.DEP_PROD_ID=dp.ID and substr(dp.prod_code,1,1) in ('2','3') and substr(DA.GL_CLASS_CODE,9,2)='14'\n"
|
||||
+ "and DA.CURR_STATUS ='O'and DA.PACS_ID not in ('02000')and da.INTT_PAID >100000 group by DA.KEY_1,DA.PACS_ID,DA.CURR_STATUS,DA.CUSTOMER_NO,DA.ACCT_OPEN_DT,\n"
|
||||
+ "and DA.CURR_STATUS ='O'and da.INTT_PAID >100000 group by DA.KEY_1,DA.PACS_ID,DA.CURR_STATUS,DA.CUSTOMER_NO,DA.ACCT_OPEN_DT,\n"
|
||||
+ "DA.INTT_PAID,DA.INTT_SOP_DATE,DA.INTT_EOP_DATE,DA.TERM_VALUE,DA.MAT_VALUE,DA.MAT_DT,DA.TERM_LENGTH,\n"
|
||||
+ "DA.NXT_DUE_DATE,DA.INTT_PROJECTED,dp.INTT_PAYOUT_FREQ,DP.PROD_CODE";
|
||||
PreparedStatement preparedStatement = conn.prepareStatement(depAccountSql);
|
||||
@ -112,9 +110,12 @@ public class TDS_Calculation {
|
||||
try (Connection conn = DriverManager.getConnection(URL, USERNAME, PASWORD)) {
|
||||
for (Map<String, Object> acc : depAccountsDetails) {
|
||||
String CIF_No = (String) acc.get("CUSTOMER_NO");
|
||||
String KEY_1 = (String) acc.get("KEY_1");
|
||||
Double INTT_PAID = (Double) acc.get("INTT_PAID");
|
||||
String PACS_ID = (String) acc.get("PACS_ID");
|
||||
|
||||
String ID_TYPE = identificationData.get(CIF_No);
|
||||
System.out.println("ID TYPE is: " + ID_TYPE);
|
||||
//System.out.println("ID TYPE is: " + ID_TYPE);
|
||||
|
||||
// LocalDate birthDt = null;
|
||||
String bDaySql = "SELECT TO_CHAR(TO_DATE(BIRTH_DATE,'DD-MM-YYYY'),'DD-MM-YYYY') AS BIRTH_DATE FROM KYC_HDR WHERE CIF_NO = ?";
|
||||
@ -147,9 +148,9 @@ public class TDS_Calculation {
|
||||
}
|
||||
|
||||
if ("PAN CARD".equalsIgnoreCase(ID_TYPE)) {
|
||||
PanAvailability(depAccountsDetails, CIF_No, formType);
|
||||
PanAvailability(KEY_1,INTT_PAID, CIF_No, formType,PACS_ID);
|
||||
} else {
|
||||
PanNotAvailability(depAccountsDetails, CIF_No, formType);
|
||||
PanNotAvailability(KEY_1,INTT_PAID, CIF_No, formType,PACS_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,9 +160,9 @@ public class TDS_Calculation {
|
||||
}
|
||||
}
|
||||
|
||||
public static void PanAvailability(List<Map<String, Object>> depAccountsDetails, String CIF_No, String formType) {
|
||||
public static void PanAvailability(String KEY_1,Double INTT_PAID, String CIF_No, String formType,String PACS_ID) {
|
||||
|
||||
System.out.println("CIF No:" + CIF_No + " is having Pan " + " with Form Type " + formType);
|
||||
System.out.println("CIF No:" + CIF_No + " is having Pan " + " with Form Type " + formType + " and interest Paid:" +INTT_PAID+ " for PACS ID: " +PACS_ID);
|
||||
double thresold_G = 250000;
|
||||
double thresold_H = 300000;
|
||||
double thresold = 0.0;
|
||||
@ -172,28 +173,29 @@ public class TDS_Calculation {
|
||||
} else if (formType.equalsIgnoreCase("G")) {
|
||||
thresold = thresold_G;
|
||||
}
|
||||
System.out.println("Thresold is : " + thresold);
|
||||
System.out.println("Form Type is : " + formType);
|
||||
|
||||
|
||||
DecimalFormat df_obj = new DecimalFormat("#.####");
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(URL, USERNAME, PASWORD)) {
|
||||
for (Map<String, Object> acc : depAccountsDetails) {
|
||||
String AccCIF_No = (String) acc.get("CUSTOMER_NO");
|
||||
|
||||
//System.out.println("AccCIF No: " + AccCIF_No);
|
||||
if (CIF_No.equals(AccCIF_No)) {
|
||||
String KEY_1 = (String) acc.get("KEY_1");
|
||||
Double INTT_PAID = (Double) acc.get("INTT_PAID");
|
||||
double INTT_PROJECTED = (double) acc.get("INTT_PROJECTED");
|
||||
// Added for GL_TXN calculations
|
||||
String PACS_ID = (String) acc.get("PACS_ID");
|
||||
// for (Map<String, Object> acc : depAccountsDetails) {
|
||||
// String AccCIF_No = (String) acc.get("CUSTOMER_NO");
|
||||
//
|
||||
// System.out.println("AccCIF No: " + AccCIF_No);
|
||||
// if (CIF_No.equals(AccCIF_No)) {
|
||||
// String KEY_1 = (String) acc.get("KEY_1");
|
||||
// Double INTT_PAID = (Double) acc.get("INTT_PAID");
|
||||
// // double INTT_PROJECTED = (double) acc.get("INTT_PROJECTED");
|
||||
//
|
||||
//
|
||||
// // Added for GL_TXN calculations
|
||||
// String PACS_ID = (String) acc.get("PACS_ID");
|
||||
|
||||
// extract the Form _id from FORM15G_H table.
|
||||
String getFormData = "SELECT FORM_ID,KEY_1 FROM FORM15G_H WHERE KEY_1= ?";
|
||||
PreparedStatement ps = conn.prepareStatement(getFormData);
|
||||
|
||||
ps.setString(1, AccCIF_No);
|
||||
ps.setString(1, CIF_No);
|
||||
|
||||
ResultSet formResultSet = ps.executeQuery();
|
||||
|
||||
@ -222,6 +224,8 @@ public class TDS_Calculation {
|
||||
// Starting of TDS Calculation........
|
||||
if (INTT_PAID != null && INTT_PAID > thresold) {
|
||||
|
||||
System.out.println("The account number: " + KEY_1+ " has been crossed the thresold:" + INTT_PAID + "having CIF No: " +CIF_No);
|
||||
|
||||
//Calculate the TDS.//Here TDS will be 10% as PAN is avaiable
|
||||
System.out.println("Interest Paid: " + INTT_PAID);
|
||||
tds_amount = INTT_PAID * 0.10;
|
||||
@ -248,21 +252,24 @@ public class TDS_Calculation {
|
||||
insertSmt.executeQuery();
|
||||
System.out.println("post execution");
|
||||
// Need to insert the deducted amount into corresponding GL.
|
||||
insrtGLTransaction(PACS_ID, INTT_PAID, tds_amount);
|
||||
insrtGLTransaction(KEY_1,PACS_ID, INTT_PAID, tds_amount);
|
||||
|
||||
}else{
|
||||
System.out.println("INterest Paid didn't cross ");
|
||||
}
|
||||
}
|
||||
System.out.println("Interest Paid didn't cross the thresold for YES PAN");
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
System.out.println("Processing done for PAN available");
|
||||
}
|
||||
}
|
||||
|
||||
public static void PanNotAvailability(List<Map<String, Object>> depAccountsDetails, String CIF_No, String formType) {
|
||||
System.out.println("CIF No:" + CIF_No + " is not having Pan " + " with Form Type " + formType);
|
||||
public static void PanNotAvailability(String KEY_1,Double INTT_PAID, String CIF_No, String formType,String PACS_ID) {
|
||||
System.out.println("CIF No:" + CIF_No + " is not having Pan " + " with Form Type " + formType + " and interest Paid:" +INTT_PAID+ " for PACS ID: " +PACS_ID);
|
||||
|
||||
double thresold_G = 250000;
|
||||
double thresold_H = 300000;
|
||||
@ -276,25 +283,24 @@ public class TDS_Calculation {
|
||||
}
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(URL, USERNAME, PASWORD)) {
|
||||
for (Map<String, Object> acc : depAccountsDetails) {
|
||||
String AccCIF_No = (String) acc.get("CUSTOMER_NO");
|
||||
|
||||
if (CIF_No.equals(AccCIF_No)) {
|
||||
String KEY_1 = (String) acc.get("KEY_1");
|
||||
Double INTT_PAID = (Double) acc.get("INTT_PAID");
|
||||
double INTT_PROJECTED = (double) acc.get("INTT_PROJECTED");
|
||||
// thresold = formType.equals("H") ? thresold_H : thresold_G;
|
||||
//System.out.println(thresold);
|
||||
//System.out.println("Form Type is : " + formType);
|
||||
|
||||
// Added for GL_TXN calculations
|
||||
String PACS_ID = (String) acc.get("PACS_ID");
|
||||
// for (Map<String, Object> acc : depAccountsDetails) {
|
||||
// String AccCIF_No = (String) acc.get("CUSTOMER_NO");
|
||||
//
|
||||
// if (CIF_No.equals(AccCIF_No)) {
|
||||
// String KEY_1 = (String) acc.get("KEY_1");
|
||||
// Double INTT_PAID = (Double) acc.get("INTT_PAID");
|
||||
// double INTT_PROJECTED = (double) acc.get("INTT_PROJECTED");
|
||||
// // thresold = formType.equals("H") ? thresold_H : thresold_G;
|
||||
//
|
||||
//
|
||||
// // Added for GL_TXN calculations
|
||||
// String PACS_ID = (String) acc.get("PACS_ID");
|
||||
|
||||
// extract the Form _id from FORM15G_H table.
|
||||
String getFormData = "SELECT FORM_ID,KEY_1 FROM FORM15G_H WHERE KEY_1= ?";
|
||||
PreparedStatement ps = conn.prepareStatement(getFormData);
|
||||
|
||||
ps.setString(1, AccCIF_No);
|
||||
ps.setString(1, CIF_No);
|
||||
|
||||
ResultSet formResultSet = ps.executeQuery();
|
||||
|
||||
@ -323,6 +329,8 @@ public class TDS_Calculation {
|
||||
// Starting of TDS Calculation........
|
||||
if (INTT_PAID != null && INTT_PAID > thresold) {
|
||||
|
||||
System.out.println("The account number: " + KEY_1+ " has been crossed the thresold:" + INTT_PAID + "having CIF No: " +CIF_No);
|
||||
|
||||
//Calculate the TDS.//Here TDS will be 10% as PAN is avaiable
|
||||
System.out.println("Interest Paid for NO PAN: " + INTT_PAID);
|
||||
tds_amount = INTT_PAID * 0.20;
|
||||
@ -344,24 +352,29 @@ public class TDS_Calculation {
|
||||
insertSmt.executeQuery();
|
||||
|
||||
// Need to insert the deducted amount into corresponding GL.
|
||||
insrtGLTransaction(PACS_ID, INTT_PAID, tds_amount);
|
||||
}
|
||||
}
|
||||
insrtGLTransaction(KEY_1,PACS_ID, INTT_PAID, tds_amount);
|
||||
}else{
|
||||
System.out.println("Interest Paid didn't cross the thresold for No Pan");
|
||||
}
|
||||
// }
|
||||
//}
|
||||
// System.out.println("Interest Paid: " + INTT_PAID + " for the account: " +KEY_1);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
System.out.println("Processing done for PAN not available");
|
||||
}
|
||||
}
|
||||
|
||||
public static double calculateProjectedAmount(Map<String, Object> accNo) {
|
||||
public static void calculateProjectedAmount(Map<String, Object> accNo) {
|
||||
|
||||
int termValue = (int) accNo.get("TERM_VALUE");
|
||||
// int termValue = (int) accNo.get("TERM_VALUE");
|
||||
double INTT_PROJECTED = (double) accNo.get("INTT_PROJECTED");
|
||||
int termLength = (int) accNo.get("TERM_LENGTH"); //in days as per IPKS DB
|
||||
// int termLength = (int) accNo.get("TERM_LENGTH"); //in days as per IPKS DB
|
||||
String inttPayoutFre = ((String) accNo.get("INTT_PAYOUT_FREQ")).trim();
|
||||
|
||||
String prodCode = (String) accNo.get("PROD_CODE");
|
||||
String accNum = (String) accNo.get("KEY_1");
|
||||
int temp = 0;
|
||||
|
||||
switch (inttPayoutFre) {
|
||||
@ -384,8 +397,10 @@ public class TDS_Calculation {
|
||||
|
||||
//calculate projected amount
|
||||
double projectedAmount = INTT_PROJECTED * temp;
|
||||
return projectedAmount;
|
||||
//insertProjectedAmount(accNo,projectedAmount);
|
||||
System.out.println("Calculation is done for Account No: " + accNum + " and Projected Amount is : " +projectedAmount);
|
||||
// return projectedAmount;
|
||||
insertProjectedAmount(accNum, projectedAmount, prodCode);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -410,7 +425,8 @@ public class TDS_Calculation {
|
||||
ps.setTimestamp(4, Timestamp.valueOf(LocalDateTime.now()));
|
||||
ps.setDouble(5, projectedAmt);
|
||||
|
||||
ps.executeUpdate();
|
||||
boolean i= ps.executeUpdate()>0;
|
||||
System.out.println("inserted Projected amount for : " + accNo );
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -482,7 +498,7 @@ public class TDS_Calculation {
|
||||
}
|
||||
|
||||
//This is the method of GL Transaction
|
||||
public static void insrtGLTransaction(String PACS_ID, double INTT_PAID, double tds_amount) {
|
||||
public static void insrtGLTransaction(String KEY,String PACS_ID, double INTT_PAID, double tds_amount) {
|
||||
|
||||
// String KEY_1 = null;
|
||||
double TXN_AMT = INTT_PAID - tds_amount;
|
||||
@ -573,11 +589,11 @@ else {
|
||||
PreparedStatement ps = conn.prepareStatement(insertGLTxn);
|
||||
ps.setString(1, "003");
|
||||
ps.setString(2, KEY_1);
|
||||
ps.setLong(3, randomNumberGeneration);
|
||||
ps.setString(3, KEY);
|
||||
ps.setDate(4, java.sql.Date.valueOf(LocalDate.now()));
|
||||
ps.setDate(5, java.sql.Date.valueOf(LocalDate.now()));
|
||||
ps.setTimestamp(6, Timestamp.valueOf(LocalDateTime.now()));
|
||||
ps.setLong(7, randomNumberGeneration);
|
||||
ps.setLong(7, randomNumberGeneration);//randomNumberGeneration
|
||||
ps.setString(8, "CR");
|
||||
ps.setDouble(9, end_bal);
|
||||
ps.setDouble(10, tds_amount);
|
||||
|
Loading…
x
Reference in New Issue
Block a user