|
|
@ -1,12 +1,12 @@ |
|
|
package in.gov.chennaicorporation.gccoffice.pgr.service; |
|
|
package in.gov.chennaicorporation.gccoffice.pgr.service; |
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
import java.sql.Connection; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.sql.ResultSet; |
|
|
import java.sql.ResultSet; |
|
|
import java.sql.ResultSetMetaData; |
|
|
import java.sql.ResultSetMetaData; |
|
|
|
|
|
import java.sql.SQLException; |
|
|
import java.sql.Statement; |
|
|
import java.sql.Statement; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Collections; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import in.gov.chennaicorporation.gccoffice.pgr.dbconnection.DBConnection; |
|
|
import in.gov.chennaicorporation.gccoffice.pgr.dbconnection.DBConnection; |
|
|
|
|
|
import in.gov.chennaicorporation.gccoffice.pgr.dto.Department; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class ZonewiseReports { |
|
|
public class ZonewiseReports { |
|
|
@ -22,6 +23,53 @@ public class ZonewiseReports { |
|
|
@Autowired |
|
|
@Autowired |
|
|
DBConnection dbcon; |
|
|
DBConnection dbcon; |
|
|
|
|
|
|
|
|
|
|
|
public List<Department> getAlldeparments() { |
|
|
|
|
|
List<Department> complaintdept = new ArrayList<>(); |
|
|
|
|
|
Connection con = DBConnection.getConnection(); |
|
|
|
|
|
Statement stmt = null; |
|
|
|
|
|
ResultSet rs = null; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
stmt = con.createStatement(); |
|
|
|
|
|
rs = stmt.executeQuery(getDepartmentQuery()); |
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
|
|
Department departments = new Department(); |
|
|
|
|
|
departments.setId(rs.getString("id_dept")); |
|
|
|
|
|
departments.setName(rs.getString("dept_name")); |
|
|
|
|
|
complaintdept.add(departments); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return complaintdept; |
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} finally { |
|
|
|
|
|
try { |
|
|
|
|
|
if (rs != null) { |
|
|
|
|
|
rs.close(); |
|
|
|
|
|
} |
|
|
|
|
|
if (stmt != null) { |
|
|
|
|
|
stmt.close(); |
|
|
|
|
|
} |
|
|
|
|
|
if (con != null) { |
|
|
|
|
|
con.close(); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Collections.emptyList(); // Return an empty list if there's an error |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getDepartmentQuery() { |
|
|
|
|
|
return "SELECT id_dept, dept_name " |
|
|
|
|
|
+ "FROM EG_DEPARTMENT@ERP " |
|
|
|
|
|
+ "WHERE NVL(dept_name, '0') NOT LIKE 'F%' AND dept_name IS NOT NULL AND id_dept >= 32 " |
|
|
|
|
|
+ "ORDER BY id_dept"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getzoneQuery(String sFrDate,String sToDate,String DEPT_NAME) { |
|
|
public String getzoneQuery(String sFrDate,String sToDate,String DEPT_NAME) { |
|
|
|
|
|
|
|
|
|