Browse Source

Changes in Green Committee report

master
Hariprasath S 3 months ago
parent
commit
f978988722
  1. 3
      src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
  2. 30
      src/main/java/com/gcc/commissionerreview/service/GreenCommitteeService.java
  3. 15
      src/main/resources/templates/modules/greencommittee/gcreport.html

3
src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java

@ -20,8 +20,7 @@ public class DataSourceConfig {
// private static String host = "localhost:3306"; // private static String host = "localhost:3306";
// private static String dbpassword = "root"; // private static String dbpassword = "root";
private static String host =
"gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
private static String host ="gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
private static String dbpassword = "gcc-facial-password"; private static String dbpassword = "gcc-facial-password";
public static class MyDataSourceConfig { public static class MyDataSourceConfig {

30
src/main/java/com/gcc/commissionerreview/service/GreenCommitteeService.java

@ -56,6 +56,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -69,6 +71,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -82,6 +86,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -95,6 +101,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -104,7 +112,7 @@ public class GreenCommitteeService {
" WHERE id.ref_id = rd.ref_id AND id.isactive=1 " + " WHERE id.ref_id = rd.ref_id AND id.isactive=1 " +
" AND ( (rd.reinspection_id IS NULL AND id.reinspection_id IS NULL) " + " AND ( (rd.reinspection_id IS NULL AND id.reinspection_id IS NULL) " +
" OR (rd.reinspection_id=id.reinspection_id) ) " + " OR (rd.reinspection_id=id.reinspection_id) ) " +
" ) = 3 " +
" ) >= 2 " +
" THEN 1 ELSE 0 END), 0) AS committee_pending, " + " THEN 1 ELSE 0 END), 0) AS committee_pending, " +
" COALESCE(SUM(CASE WHEN rd.is_withdraw = 1 THEN 1 ELSE 0 END), 0) AS withdrawn, " + " COALESCE(SUM(CASE WHEN rd.is_withdraw = 1 THEN 1 ELSE 0 END), 0) AS withdrawn, " +
@ -115,8 +123,7 @@ public class GreenCommitteeService {
"FROM zone_master zm " + "FROM zone_master zm " +
"LEFT JOIN reg_details rd " + "LEFT JOIN reg_details rd " +
" ON rd.zone = zm.zone_name " +
" AND rd.is_active = 1 ";
" ON rd.zone = zm.zone_name ";
StringBuilder sql = new StringBuilder(baseSql); StringBuilder sql = new StringBuilder(baseSql);
List<Object> params = new ArrayList<>(); List<Object> params = new ArrayList<>();
@ -155,6 +162,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -168,6 +177,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -181,6 +192,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -194,6 +207,8 @@ public class GreenCommitteeService {
" COALESCE(SUM(CASE " + " COALESCE(SUM(CASE " +
" WHEN rd.ref_id IS NOT NULL " + " WHEN rd.ref_id IS NOT NULL " +
" AND rd.is_active = 1 " +
" AND rd.is_delete = 0 " +
" AND rd.is_withdraw = 0 " + " AND rd.is_withdraw = 0 " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " +
" AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " +
@ -203,7 +218,7 @@ public class GreenCommitteeService {
" WHERE id.ref_id = rd.ref_id AND id.isactive=1 " + " WHERE id.ref_id = rd.ref_id AND id.isactive=1 " +
" AND ( (rd.reinspection_id IS NULL AND id.reinspection_id IS NULL) " + " AND ( (rd.reinspection_id IS NULL AND id.reinspection_id IS NULL) " +
" OR (rd.reinspection_id = id.reinspection_id) ) " + " OR (rd.reinspection_id = id.reinspection_id) ) " +
" ) = 3 " +
" ) >= 2 " +
" THEN 1 ELSE 0 END), 0) AS committee_pending, " + " THEN 1 ELSE 0 END), 0) AS committee_pending, " +
" COALESCE(SUM(CASE WHEN rd.is_withdraw=1 THEN 1 ELSE 0 END), 0) AS withdrawn, " + " COALESCE(SUM(CASE WHEN rd.is_withdraw=1 THEN 1 ELSE 0 END), 0) AS withdrawn, " +
@ -215,8 +230,7 @@ public class GreenCommitteeService {
"FROM ward_master wm " + "FROM ward_master wm " +
"JOIN zone_master zm ON zm.id = wm.zone_id AND zm.zone_name = ? " + "JOIN zone_master zm ON zm.id = wm.zone_id AND zm.zone_name = ? " +
"LEFT JOIN reg_details rd " + "LEFT JOIN reg_details rd " +
" ON rd.ward = wm.ward_name " +
" AND rd.is_active = 1 ";
" ON rd.ward = wm.ward_name ";
StringBuilder sql = new StringBuilder(baseSql); StringBuilder sql = new StringBuilder(baseSql);
List<Object> params = new ArrayList<>(); List<Object> params = new ArrayList<>();
@ -331,6 +345,8 @@ public class GreenCommitteeService {
sql.append(" AND DATE(rd.cdate) <= ? "); sql.append(" AND DATE(rd.cdate) <= ? ");
params.add(endDate); params.add(endDate);
} }
System.out.println("sql="+sql);
return jdbcTemplate.query( return jdbcTemplate.query(
sql.toString(), sql.toString(),
@ -349,7 +365,7 @@ public class GreenCommitteeService {
// 1 — Application details // 1 — Application details
Map<String, Object> app = jdbcTemplate.queryForMap( Map<String, Object> app = jdbcTemplate.queryForMap(
"SELECT *,DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as r_Cdate,IFNULL(reinspection_id, '') AS com_reinspection_id FROM reg_details WHERE ref_id=? AND is_active=1",
"SELECT *,DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as r_Cdate,IFNULL(reinspection_id, '') AS com_reinspection_id,DATE_FORMAT(withdraw_date, '%d-%m-%Y %l:%i %p') as withdraw_Cdate FROM reg_details WHERE ref_id=? ",
refId refId
); );

15
src/main/resources/templates/modules/greencommittee/gcreport.html

@ -562,7 +562,7 @@
function openPendingModal(zone, ward, type, startDate, endDate, level) { function openPendingModal(zone, ward, type, startDate, endDate, level) {
console.log("data="+zone+","+ward+","+startDate+","+endDate);
console.log("data="+zone+","+ward+","+startDate+","+endDate+",type="+type);
$('#pendingModal').modal('show'); $('#pendingModal').modal('show');
$('#pendingModalTitle').text( $('#pendingModalTitle').text(
@ -585,6 +585,7 @@
$('#pageLoader').hide(); $('#pageLoader').hide();
if (res.status === 'Success' && res.data.length > 0) { if (res.status === 'Success' && res.data.length > 0) {
console.log("res.data="+res.data);
renderComplaintCards(res.data); renderComplaintCards(res.data);
} else { } else {
$('#pendingModalBody').html( $('#pendingModalBody').html(
@ -611,7 +612,7 @@
item.p_name && item.p_name.trim() !== '' item.p_name && item.p_name.trim() !== ''
? item.p_name ? item.p_name
: [item.dept_name, item.designation].filter(Boolean).join(' - ') || '-'; : [item.dept_name, item.designation].filter(Boolean).join(' - ') || '-';
html += ` html += `
<div class="card mb-3 shadow-sm"> <div class="card mb-3 shadow-sm">
<div class="card-header bg-info text-white font-weight-bold"> <div class="card-header bg-info text-white font-weight-bold">
@ -635,6 +636,16 @@
<p><strong>Address:</strong> ${item.address}</p> <p><strong>Address:</strong> ${item.address}</p>
<p><strong>Remarks:</strong> ${item.remarks}</p> <p><strong>Remarks:</strong> ${item.remarks}</p>
<p><strong>Complaints:</strong> ${item.comp_details}</p> <p><strong>Complaints:</strong> ${item.comp_details}</p>
${
(item.withdraw_remarks && item.withdraw_remarks.trim() !== '') ||
(item.withdraw_Cdate && item.withdraw_Cdate.trim() !== '')
? `
<hr>
<p><strong>Withdraw Remarks:</strong> ${item.withdraw_remarks || '-'}</p>
<p><strong>Withdraw Date:</strong> ${item.withdraw_Cdate || '-'}</p>
`
: ''
}
</div> </div>
<!-- RIGHT (Images) --> <!-- RIGHT (Images) -->

Loading…
Cancel
Save