You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.5 KiB
94 lines
2.5 KiB
package in.gov.chennaicorporation.gccoffice.pgr.service;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.ResultSet;
|
|
import java.sql.ResultSetMetaData;
|
|
import java.sql.SQLException;
|
|
import java.sql.Statement;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import in.gov.chennaicorporation.gccoffice.pgr.dbconnection.DBConnection;
|
|
|
|
@Service
|
|
public class AgeAnalysisComplaintDetails {
|
|
|
|
@Autowired
|
|
DBConnection dbcon;
|
|
|
|
public String sFrDate ="";
|
|
public String sToDate ="";
|
|
|
|
|
|
public String getageanalysiscomdetailsQuery(String lCmpID) {
|
|
Connection connection = DBConnection.getConnection();; // Initialize your database connection
|
|
System.out.println("ICmpID.............:"+lCmpID);
|
|
String query = "select a.*,nvl(to_char(a.complaintdate,'dd-mm-rrrr'),' ') compdate,c.DEPT_NAME from eggr_complaintdetails@erp a,EG_DEPARTMENT@ERP c where a.deptid=c.id_dept and a.complaintid="+ lCmpID;
|
|
System.out.println(query);
|
|
try {
|
|
PreparedStatement preparedStatement = connection.prepareStatement(query);
|
|
preparedStatement.setString(1, lCmpID); // Bind the parameter
|
|
|
|
ResultSet resultSet = preparedStatement.executeQuery();
|
|
|
|
// Process the result set and return the result
|
|
|
|
resultSet.close();
|
|
preparedStatement.close();
|
|
} catch (SQLException e) {
|
|
// Handle any SQL errors
|
|
e.printStackTrace();
|
|
} finally {
|
|
// Close the database connection
|
|
}
|
|
return query;
|
|
}
|
|
|
|
|
|
|
|
public List<Map<String, Object>> check(String lCmpID) {
|
|
Connection con =DBConnection.getConnection();
|
|
Statement stmt3;
|
|
try {
|
|
stmt3 = con.createStatement();
|
|
|
|
|
|
System.out.println( "checkingageanalysiscomplaintdetails...");
|
|
ResultSet rs3 = stmt3.executeQuery(getageanalysiscomdetailsQuery(lCmpID));
|
|
|
|
|
|
List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
|
while (rs3.next()) {
|
|
|
|
Map<String, Object> row = new HashMap<>();
|
|
|
|
|
|
ResultSetMetaData metaData = rs3.getMetaData();
|
|
int columnCount = metaData.getColumnCount();
|
|
for (int i = 1; i <= columnCount; i++) {
|
|
String columnName = metaData.getColumnName(i);
|
|
Object columnValue = rs3.getObject(i);
|
|
System.out.println(columnName+" :"+columnValue);
|
|
row.put(columnName, columnValue);
|
|
}
|
|
|
|
|
|
rows.add(row);
|
|
}
|
|
return rows;
|
|
}
|
|
catch (Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|