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.
 
 

137 lines
4.9 KiB

//package in.gov.chennaicorporation.gccoffice.pgr.service;
//
//import java.sql.Connection;
//import java.sql.ResultSet;
//import java.sql.ResultSetMetaData;
//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 MobileAgeAnalysisComplaintReports {
//
// @Autowired
// DBConnection dbcon;
//
// public String sFrDate ="";
// public String sToDate ="";
//
//
//
// public String getMobileAgeAnalysisComplaintQuery(Integer iDeptID, Integer iPgrUserID) {
//
// int iPenReOpen = 0;
//
// StringBuilder queryBuilder = new StringBuilder();
// queryBuilder.append("SELECT a.*, NVL(TO_CHAR(a.complaintdate, 'dd-mm-rrrr'), ' ') compdate, c.DEPT_NAME, u.user_name FROM ");
// queryBuilder.append("eggr_complaintdetails@erp a, EG_DEPARTMENT@ERP c, eggr_redressaldetails@erp b, eg_user@erp u ");
// queryBuilder.append("WHERE a.deptid = c.id_dept AND (NVL(DEPT_NAME, '0') NOT LIKE 'F%' AND DEPT_NAME IS NOT NULL) ");
// queryBuilder.append("AND a.complaintid = b.complaintid AND complaintdate >= TO_DATE('25-Oct-2010', 'DD-Mon-YYYY') ");
// queryBuilder.append("AND u.id_user = b.redressalofficerid ");
//
// if (iPenReOpen == 0) {
// queryBuilder.append("AND b.COMPLAINTSTATUSID IN (2, 3, 4, 9) ");
// } else if (iPenReOpen == 1) {
// queryBuilder.append("AND b.COMPLAINTSTATUSID IN (2, 3, 4) ");
// } else if (iPenReOpen == 2) {
// queryBuilder.append("AND b.COMPLAINTSTATUSID IN (9) ");
// }
//
// /* if (iRptID == 1) {
// queryBuilder.append("AND NVL(a.RECEIVINGCENTERID, 0) = 1 ");
// } else if (iRptID == 2) {
// queryBuilder.append("AND NVL(a.RECEIVINGCENTERID, 0) != 1 ");
// }
//*/
// if (iDeptID != 0) {
// queryBuilder.append("AND NVL(a.deptid, 0) = ").append(iDeptID).append(" ");
// }
///*
// if (iDaysID == 1) {
// queryBuilder.append("AND (SYSDATE - complaintdate) > 90 ");
// } else if (iDaysID == 2) {
// queryBuilder.append("AND SYSDATE - complaintdate > 60 AND SYSDATE - complaintdate <= 90 ");
// } else if (iDaysID == 3) {
// queryBuilder.append("AND SYSDATE - complaintdate > 30 AND SYSDATE - complaintdate <= 60 ");
// } else if (iDaysID == 4) {
// queryBuilder.append("AND SYSDATE - complaintdate > 15 AND SYSDATE - complaintdate <= 30 ");
// } else if (iDaysID == 5) {
// queryBuilder.append("AND SYSDATE - complaintdate > 0 AND SYSDATE - complaintdate <= 15 ");
// }
//*/
// if (iPgrUserID != 0 && iDeptID != 37) {
// queryBuilder.append("AND NVL(b.redressalofficerid, 0) = ").append(iPgrUserID).append(" ");
// }
//
// if (!sFrDate.isEmpty() && !sToDate.isEmpty()) {
// queryBuilder.append("AND TRUNC(complaintdate) BETWEEN TO_DATE('").append(sFrDate).append("', 'DD/MM/YYYY') ");
// queryBuilder.append("AND TO_DATE('").append(sToDate).append("', 'DD/MM/YYYY') ");
// }
///*
// if ("52,1,22,32,57,59,70,18,69,7,71,19,58,75,43".equals(sComplainttype)) {
// queryBuilder.append("AND a.complainttype NOT IN ('52,1,22,32,57,59,70,18,69,7,71,19,75,58,43,146,97,113,114,130,145,118,138,99,152,119,181,112,166') ");
// } else if (!"0".equals(sComplainttype)) {
// queryBuilder.append("AND complainttype IN (").append(sComplainttype).append(") ");
// }
//*/
// queryBuilder.append("ORDER BY user_name, a.complaintdate");
//
// String sqlQuery = queryBuilder.toString();
// System.out.println("sQry: " + sqlQuery);
// return sqlQuery;
// }
//
//
//
//
//
//
//
// public List<Map<String, Object>> getMobileAgeAnalysisComplaints( Integer deptId, Integer pgrUserId) {
// Connection con =DBConnection.getConnection();
// Statement stmt3;
// try {
// stmt3 = con.createStatement();
//
//
// System.out.println( "checkingmobileageanalysiscomreports...");
// //String sComplainttype ="52,1,22,32,57,59,70,18,69,7,71,19,75,58,43,146,97,113,114,130,145,118,138,99,152,119,181,112,166";
// ResultSet rs4 = stmt3.executeQuery(getMobileAgeAnalysisComplaintQuery(deptId, pgrUserId));
//
//
// List<Map<String, Object>> rows = new ArrayList<>();
//
// while (rs4.next()) {
//
// Map<String, Object> row = new HashMap<>();
//
//
// ResultSetMetaData metaData = rs4.getMetaData();
// int columnCount = metaData.getColumnCount();
// for (int i = 1; i <= columnCount; i++) {
// String columnName = metaData.getColumnName(i);
// Object columnValue = rs4.getObject(i);
// // System.out.println(columnName+" :"+columnValue);
// row.put(columnName, columnValue);
// }
//
//
// rows.add(row);
// }
// return rows;
// }
// catch (Exception e){
// e.printStackTrace();
// }
// return null;
//}
//
//}