package com.gcc.erppostdata.communityhall; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class CmhQueryBank { @Autowired CHPostData chPostData; public void hourlyPushData(int bookingId) { String hourlysql = "SELECT " + " tr.txansaction_id, " + " tr.tpsl_txn_id, " + " tr.amount, " + " DATE_FORMAT(STR_TO_DATE(tr.date, '%d-%m-%Y'),'%d/%m/%Y') as trans_date, " + " bk.booking_status, " + " bk.hall_amount, " + " bk.deposit_amount, " + " bk.gst, " + " us.name, " + " us.mobile_no, " + " CONCAT(us.street, ', ', us.location) AS full_address, " + " bk.booking_id " + "FROM transaction_response tr " + "INNER JOIN users us ON tr.user_id = us.user_id " + "INNER JOIN booking_details bk ON bk.booking_id = tr.booking_id " + "WHERE tr.status_code = '0300' " + // "AND bk.booking_status IN ('APPROVED', 'CANCELED', 'COMPLETED', 'GCC_BLOCKED') " + // "AND STR_TO_DATE(tr.date, '%d-%m-%Y %H:%i:%s') >= NOW() - INTERVAL 2 HOUR" " AND STR_TO_DATE(tr.date, '%d-%m-%Y %H:%i:%s') <= NOW() - INTERVAL 1 HOUR" + " AND bk.booking_id >'"+bookingId+"' order by bk.booking_id LIMIT 1000" ; System.out.println(hourlysql); chPostData.fetchChData(hourlysql,null,null); } public void PushAllData() { String sql = "SELECT " + " tr.txansaction_id, " + " tr.tpsl_txn_id, " + " tr.amount, " + " DATE_FORMAT(STR_TO_DATE(tr.date, '%d-%m-%Y'),'%d/%m/%Y') as trans_date, " + " bk.booking_status, " + " bk.hall_amount, " + " bk.deposit_amount, " + " bk.gst, " + " us.name, " + " us.mobile_no, " + " CONCAT(us.street, ', ', us.location) AS full_address, " + " bk.booking_id " + "FROM transaction_response tr " + "INNER JOIN users us ON tr.user_id = us.user_id " + "INNER JOIN booking_details bk ON bk.booking_id = tr.booking_id " + "WHERE tr.status_code = '0300' " + // "AND bk.booking_status IN ('APPROVED', 'CANCELED', 'COMPLETED', 'GCC_BLOCKED') " + "AND tr.date < NOW() - INTERVAL 1 HOUR order by bk.booking_id;"; chPostData.fetchChData(sql,null,null); } public void resendPushData(String transactionId,String id) { String sql = "SELECT " + " tr.txansaction_id, " + " tr.tpsl_txn_id, " + " tr.amount, " + " DATE_FORMAT(STR_TO_DATE(tr.date, '%d-%m-%Y'),'%d/%m/%Y') as trans_date, " + " bk.booking_status, " + " bk.hall_amount, " + " bk.deposit_amount, " + " bk.gst, " + " us.name, " + " us.mobile_no, " + " CONCAT(us.street, ', ', us.location) AS full_address, " + " bk.booking_id " + "FROM transaction_response tr " + "INNER JOIN users us ON tr.user_id = us.user_id " + "INNER JOIN booking_details bk ON bk.booking_id = tr.booking_id " + "WHERE tr.txansaction_id = '" +transactionId+"' "+ // "AND bk.booking_status IN ('APPROVED', 'CANCELED', 'COMPLETED', 'GCC_BLOCKED') " + // "AND STR_TO_DATE(tr.date, '%d-%m-%Y %H:%i:%s') <= NOW() - INTERVAL 2 HOUR" // " AND STR_TO_DATE(tr.date, '%d-%m-%Y %H:%i:%s') >= NOW() - INTERVAL 1 HOUR" " AND tr.status_code = '0300' order by bk.booking_id" ; chPostData.fetchChData(sql,transactionId,id); } }