Browse Source

Officer Portal Updated code

main
kanimozhi 8 months ago
parent
commit
ab93f2a9c1
  1. 67
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAgentsService.java
  2. 9
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java
  3. 400
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
  4. 231
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/controller/FlagPoleApiController.java
  5. 133
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/service/FlagpoleSMSService.java
  6. 1225
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/service/RdoService.java
  7. 45
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/service/WhatsappServiceFlagPole.java
  8. 41
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/util/MessageUtility.java
  9. 4
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/service/PendinglistService.java
  10. 3
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java
  11. 9
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java
  12. 4
      gcc_officer_portal/src/main/resources/application.properties
  13. 4
      gcc_officer_portal/src/main/resources/templates/modules/callcenterqaqc/socialmediacomplaints.html
  14. 31
      gcc_officer_portal/src/main/resources/templates/modules/flagpole/approvedandrejectedlist.html
  15. 549
      gcc_officer_portal/src/main/resources/templates/modules/flagpole/requestlist.html
  16. 1
      gcc_officer_portal/src/main/resources/templates/modules/m_petition/complaint_list.html
  17. 1
      gcc_officer_portal/src/main/resources/templates/modules/m_petition/petition_list.html
  18. 3
      gcc_officer_portal/src/main/resources/templates/modules/nulm/salary-approve.html

67
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/QaqcAgentsService.java

@ -239,29 +239,50 @@ public class QaqcAgentsService {
public List<Map<String, Object>> getAgentPerformanceData(int agentId, String startDate, String endDate) { public List<Map<String, Object>> getAgentPerformanceData(int agentId, String startDate, String endDate) {
String sql = "SELECT \n"
+ " COALESCE(total_data_count, 0) AS total_data_count,\n" // Ensure total_data_count is 0 if null
+ " COALESCE(completed_count, 0) AS completed_count,\n" // Ensure completed_count is 0 if null
+ " COALESCE((total_data_count - completed_count), 0) AS pending_count,\n" // Ensure pending_count is 0
+ " CASE \n"
+ " WHEN COALESCE(total_data_count, 0) > 0 THEN ROUND((COALESCE(completed_count, 0) / total_data_count) * 100, 1)\n"
+ " ELSE 0\n"
+ " END AS completed_percentage\n"
+ "FROM \n"
+ " (\n"
+ " SELECT \n"
+ " (SELECT COALESCE(SUM(aa.data_count), 0) \n"
+ " FROM agent_assigned aa \n"
+ " WHERE aa.agent_id = ? AND DATE(aa.created_date) BETWEEN ? AND ?) AS total_data_count,\n"
+ " \n"
+ " (SELECT COALESCE(COUNT(*), 0) \n"
+ " FROM qaqc_call_logs cl \n"
+ " WHERE cl.agent_id = ?\n"
+ " AND DATE(cl.created_date) BETWEEN ? AND ? \n"
+ " AND cl.call_status IS NOT NULL) AS completed_count\n"
+ " ) AS combined";
return jdbcTemplate.queryForList(sql, agentId, startDate, endDate, agentId, startDate, endDate);
// String sql = "SELECT \n"
// + " COALESCE(total_data_count, 0) AS total_data_count,\n" // Ensure total_data_count is 0 if null
// + " COALESCE(completed_count, 0) AS completed_count,\n" // Ensure completed_count is 0 if null
// + " COALESCE((total_data_count - completed_count), 0) AS pending_count,\n" // Ensure pending_count is 0
// + " CASE \n"
// + " WHEN COALESCE(total_data_count, 0) > 0 THEN ROUND((COALESCE(completed_count, 0) / total_data_count) * 100, 1)\n"
// + " ELSE 0\n"
// + " END AS completed_percentage\n"
// + "FROM \n"
// + " (\n"
// + " SELECT \n"
// + " (SELECT COALESCE(SUM(aa.data_count), 0) \n"
// + " FROM agent_assigned aa \n"
// + " WHERE aa.agent_id = ? AND DATE(aa.created_date) BETWEEN ? AND ?) AS total_data_count,\n"
// + " \n"
// + " (SELECT COALESCE(COUNT(*), 0) \n"
// + " FROM qaqc_call_logs cl \n"
// + " WHERE cl.agent_id = ?\n"
// + " AND DATE(cl.created_date) BETWEEN ? AND ? \n"
// + " AND cl.call_status IS NOT NULL) AS completed_count\n"
// + " ) AS combined";
// return jdbcTemplate.queryForList(sql, agentId, startDate, endDate, agentId, startDate, endDate);
String sql="SELECT "
+ " total_data_count,"
+ " completed_count,"
+ " (total_data_count - completed_count) AS pending_count,"
+ " CASE "
+ " WHEN total_data_count > 0 "
+ " THEN ROUND((completed_count / total_data_count) * 100, 1)"
+ " ELSE 0"
+ " END AS completed_percentage"
+ " FROM ("
+ " SELECT "
+ " COUNT(*) AS total_data_count,"
+ " COUNT(call_status) AS completed_count"
+ " FROM qaqc_upload_data_history"
+ " WHERE created_date >= ? "
+ " AND created_date < DATE_ADD( ? , INTERVAL 1 DAY)"
+ " AND agent_id = ? "
+ ") t";
return jdbcTemplate.queryForList(sql, startDate, endDate, agentId);
} }

9
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java

@ -25,6 +25,15 @@ public class AppConfig {
public String gccappsMysqlPassword = ""; public String gccappsMysqlPassword = "";
public String domesticurl="https://gccservices.in/gccofficialapp/api/domesticwaste"; public String domesticurl="https://gccservices.in/gccofficialapp/api/domesticwaste";
public String otpUrl = "https://tmegov.onex-aura.com/api/sms?";
public String getOtpUrl() {
return otpUrl;
}
public void setOtpUrl(String otpUrl) {
this.otpUrl = otpUrl;
}
@Bean @Bean
public RestTemplate restTemplate() { public RestTemplate restTemplate() {
return new RestTemplate(); return new RestTemplate();

400
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java

@ -23,386 +23,390 @@ import java.util.Properties;
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
public class DataSourceConfig { public class DataSourceConfig {
//private static String host = "localhost:3306";
//private static String dbpassword = "";
private static String host = "localhost:3306";
private static String dbpassword = "root";
// private static String dbpassword = "gccroot"; // private static String dbpassword = "gccroot";
// AWS
private static String host = "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
private static String dbpassword = "gcc-facial-password";
//////////////////////////////(For GCC APP) ////////////////////////
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
entityManagerFactoryRef = "appEntityManagerFactory",
transactionManagerRef = "appTransactionManager",
basePackages = {"in.gov.chennaicorporation.gccoffice.repository"})
public static class MysqlAppDataSourceConfig {
@Primary
@Bean(name = "mysqlAppDataSource")
public DataSource mysqlAppDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_apps");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
/*
@Bean(name = "mysqlAppJdbcTemplate")
public JdbcTemplate mysqlAppJdbcTemplate(@Qualifier("mysqlAppDataSource") DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
*/
@Primary
@Bean(name="appEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
@Qualifier("mysqlAppDataSource") DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setPackagesToScan("in.gov.chennaicorporation.gccoffice.entity");
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
entityManagerFactoryBean.setJpaProperties(properties);
return entityManagerFactoryBean;
}
@Primary
@Bean(name = "appTransactionManager")
public PlatformTransactionManager transactionManager(@Qualifier("appEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
return new JpaTransactionManager(entityManagerFactory);
}
}
//////////////////////////////(For Tax Collection 1913) ////////////////////////
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
entityManagerFactoryRef = "taxEntityManagerFactory",
transactionManagerRef = "taxTransactionManager",
basePackages = {"in.gov.chennaicorporation.gccoffice.taxcollection.repository"})
public static class MysqlTaxCollectionDataSourceConfig {
@Bean(name = "mysqlTaxCollectionDataSource")
public DataSource mysqlTaxCollectionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_tax_collection");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
@Bean(name="taxEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean taxEntityManagerFactory(
@Qualifier("mysqlTaxCollectionDataSource") DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setPackagesToScan("in.gov.chennaicorporation.gccoffice.taxcollection.entity");
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
entityManagerFactoryBean.setJpaProperties(properties);
return entityManagerFactoryBean;
}
@Bean(name = "taxTransactionManager")
public PlatformTransactionManager taxTransactionManager(@Qualifier("taxEntityManagerFactory") EntityManagerFactory taxEntityManagerFactory) {
return new JpaTransactionManager(taxEntityManagerFactory);
}
}
//////////////////////////////(For Mayor Petition) ////////////////////////
// AWS
// private static String host =
// "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
// private static String dbpassword = "gcc-facial-password";
////////////////////////////// (For GCC APP) ////////////////////////
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(entityManagerFactoryRef = "appEntityManagerFactory", transactionManagerRef = "appTransactionManager", basePackages = {
"in.gov.chennaicorporation.gccoffice.repository" })
public static class MysqlAppDataSourceConfig {
@Primary
@Bean(name = "mysqlAppDataSource")
public DataSource mysqlAppDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_apps");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
/*
* @Bean(name = "mysqlAppJdbcTemplate")
* public JdbcTemplate mysqlAppJdbcTemplate(@Qualifier("mysqlAppDataSource")
* DataSource dataSource) {
* return new JdbcTemplate(dataSource);
* }
*/
@Primary
@Bean(name = "appEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
@Qualifier("mysqlAppDataSource") DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setPackagesToScan("in.gov.chennaicorporation.gccoffice.entity");
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
entityManagerFactoryBean.setJpaProperties(properties);
return entityManagerFactoryBean;
}
@Primary
@Bean(name = "appTransactionManager")
public PlatformTransactionManager transactionManager(
@Qualifier("appEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
return new JpaTransactionManager(entityManagerFactory);
}
}
////////////////////////////// (For Tax Collection 1913)
////////////////////////////// ////////////////////////
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(entityManagerFactoryRef = "taxEntityManagerFactory", transactionManagerRef = "taxTransactionManager", basePackages = {
"in.gov.chennaicorporation.gccoffice.taxcollection.repository" })
public static class MysqlTaxCollectionDataSourceConfig {
@Bean(name = "mysqlTaxCollectionDataSource")
public DataSource mysqlTaxCollectionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_tax_collection");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
@Bean(name = "taxEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean taxEntityManagerFactory(
@Qualifier("mysqlTaxCollectionDataSource") DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setPackagesToScan("in.gov.chennaicorporation.gccoffice.taxcollection.entity");
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
entityManagerFactoryBean.setJpaProperties(properties);
return entityManagerFactoryBean;
}
@Bean(name = "taxTransactionManager")
public PlatformTransactionManager taxTransactionManager(
@Qualifier("taxEntityManagerFactory") EntityManagerFactory taxEntityManagerFactory) {
return new JpaTransactionManager(taxEntityManagerFactory);
}
}
////////////////////////////// (For Mayor Petition) ////////////////////////
@Bean(name = "mysqlMayorPetitionDataSource") @Bean(name = "mysqlMayorPetitionDataSource")
public DataSource mysqlMayorPetitionDataSource() { public DataSource mysqlMayorPetitionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/mayor_petition");
dataSource.setUrl("jdbc:mysql://" + host + "/mayor_petition");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For Commissioner Petition) ////////////////////////
////////////////////////////// (For Commissioner Petition)
////////////////////////////// ////////////////////////
@Bean(name = "mysqlCommissionerPetitionDataSource") @Bean(name = "mysqlCommissionerPetitionDataSource")
public DataSource mysqlCommissionerPetitionDataSource() { public DataSource mysqlCommissionerPetitionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/commissioner_petition");
dataSource.setUrl("jdbc:mysql://" + host + "/commissioner_petition");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For Petition Master) ////////////////////////
@Bean(name = "mysqlPetitionMasterDataSource")
public DataSource mysqlPetitionMasterDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/petition_master");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
//////////////////////////////(For Councillor Petition) ////////////////////////
////////////////////////////// (For Petition Master) ////////////////////////
@Bean(name = "mysqlPetitionMasterDataSource")
public DataSource mysqlPetitionMasterDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/petition_master");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
////////////////////////////// (For Councillor Petition)
////////////////////////////// ////////////////////////
@Bean(name = "mysqlCouncillorPetitionDataSource") @Bean(name = "mysqlCouncillorPetitionDataSource")
public DataSource mysqlCouncillorPetitionDataSource() { public DataSource mysqlCouncillorPetitionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/councillor_petition");
dataSource.setUrl("jdbc:mysql://" + host + "/councillor_petition");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For PGR Master) ////////////////////////
////////////////////////////// (For PGR Master) ////////////////////////
@Bean(name = "mysqlPGRMasterDataSource") @Bean(name = "mysqlPGRMasterDataSource")
public DataSource mysqlPGRMasterDataSource() { public DataSource mysqlPGRMasterDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/erp_pgr");
dataSource.setUrl("jdbc:mysql://" + host + "/erp_pgr");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For Circular Petition) ////////////////////////
////////////////////////////// (For Circular Petition) ////////////////////////
@Bean(name = "mysqlCircularDataSource") @Bean(name = "mysqlCircularDataSource")
public DataSource mysqlCircularDataSource() { public DataSource mysqlCircularDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/circular");
dataSource.setUrl("jdbc:mysql://" + host + "/circular");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For NULM Staff) ////////////////////////
////////////////////////////// (For NULM Staff) ////////////////////////
@Bean(name = "mysqlNulmDataSource") @Bean(name = "mysqlNulmDataSource")
public DataSource mysqlNulmDataSource() { public DataSource mysqlNulmDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_nulm");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_nulm");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For Zero Hours Petition) ////////////////////////
////////////////////////////// (For Zero Hours Petition)
////////////////////////////// ////////////////////////
@Bean(name = "mysqlZeroHoursDataSource") @Bean(name = "mysqlZeroHoursDataSource")
public DataSource mysqlZeroHoursDataSource() { public DataSource mysqlZeroHoursDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/zerohours_petition");
dataSource.setUrl("jdbc:mysql://" + host + "/zerohours_petition");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For Ward Sabha) ////////////////////////
////////////////////////////// (For Ward Sabha) ////////////////////////
@Bean(name = "mysqlWardSabhaDataSource") @Bean(name = "mysqlWardSabhaDataSource")
public DataSource mysqlWardSabhaDataSource() { public DataSource mysqlWardSabhaDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/ward_sabha");
dataSource.setUrl("jdbc:mysql://" + host + "/ward_sabha");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For 1913 Campaign) ////////////////////////
////////////////////////////// (For 1913 Campaign) ////////////////////////
@Bean(name = "mysql1913CampaignDataSource") @Bean(name = "mysql1913CampaignDataSource")
public DataSource mysql1913CampaignDataSource() { public DataSource mysql1913CampaignDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_1913_campaign");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_1913_campaign");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For 1913 QAQC) ////////////////////////
////////////////////////////// (For 1913 QAQC) ////////////////////////
@Bean(name = "mysql1913QAQCDataSource") @Bean(name = "mysql1913QAQCDataSource")
public DataSource mysql1913QAQCDataSource() { public DataSource mysql1913QAQCDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_1913_qaqc");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_1913_qaqc");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For SOS) ////////////////////////
////////////////////////////// (For SOS) ////////////////////////
@Bean(name = "mysqlGccSOSDataSource") @Bean(name = "mysqlGccSOSDataSource")
public DataSource mysqlGccSOSDataSource() { public DataSource mysqlGccSOSDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_sos");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_sos");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For Kural) ////////////////////////
////////////////////////////// (For Kural) ////////////////////////
@Bean(name = "mysqlKuralDataSource") @Bean(name = "mysqlKuralDataSource")
public DataSource mysqlKuralDataSource() { public DataSource mysqlKuralDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/Kural");
dataSource.setUrl("jdbc:mysql://" + host + "/Kural");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For WORKS) ////////////////////////
////////////////////////////// (For WORKS) ////////////////////////
@Bean(name = "mysqlWorksDataSource") @Bean(name = "mysqlWorksDataSource")
public DataSource mysqlWorksDataSource() { public DataSource mysqlWorksDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_works_status");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_works_status");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
} }
//////////////////////////////(For Ward Sabha) ////////////////////////
////////////////////////////// (For Ward Sabha) ////////////////////////
@Bean(name = "mysqlWardShabaDataSource") @Bean(name = "mysqlWardShabaDataSource")
public DataSource mysqlWardShabaDataSource() { public DataSource mysqlWardShabaDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/ward_sabha");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/ward_sabha");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
} }
//////////////////////////////(For V-Track (jTrack)) ////////////////////////
////////////////////////////// (For V-Track (jTrack)) ////////////////////////
@Bean(name = "mysqlVehiclTrackingDataSource") @Bean(name = "mysqlVehiclTrackingDataSource")
public DataSource mysqlVehiclTrackingDataSource() { public DataSource mysqlVehiclTrackingDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_vtrack");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_vtrack");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For school) ////////////////////////
////////////////////////////// (For school) ////////////////////////
@Bean(name = "mysqlSchoolDataSource") @Bean(name = "mysqlSchoolDataSource")
public DataSource mysqlSchoolDataSource() { public DataSource mysqlSchoolDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_schools_web");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_schools_web");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For dump registration) ////////////////////////
////////////////////////////// (For dump registration) ////////////////////////
@Bean(name = "mysqlFlagPoleManagerSystemDataSource") @Bean(name = "mysqlFlagPoleManagerSystemDataSource")
public DataSource mysqlFlagPoleManagerSystemDataSource() { public DataSource mysqlFlagPoleManagerSystemDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_flag_pole");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_flag_pole");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource;
return dataSource;
} }
//////////////////////////////(For gcc_c_d_waste_web) ////////////////////////
////////////////////////////// (For gcc_c_d_waste_web) ////////////////////////
@Bean(name = "mysqlCDManagerSystemDataSource") @Bean(name = "mysqlCDManagerSystemDataSource")
public DataSource mysqlCDManagerSystemDataSource() { public DataSource mysqlCDManagerSystemDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_c_d_waste_web");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_c_d_waste_web");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For gcc_c_d_waste_web) ////////////////////////
////////////////////////////// (For gcc_c_d_waste_web) ////////////////////////
@Bean(name = "mysqlPensionerDataSource") @Bean(name = "mysqlPensionerDataSource")
public DataSource mysqlPensionerDataSource() {
public DataSource mysqlPensionerDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_pensioner");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_pensioner");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For gcc_c_d_waste_web) ////////////////////////
////////////////////////////// (For gcc_c_d_waste_web) ////////////////////////
@Bean(name = "mysqlGccStreetVendorDataSource") @Bean(name = "mysqlGccStreetVendorDataSource")
public DataSource mysqlGccStreetVendorDataSource() {
public DataSource mysqlGccStreetVendorDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_street_vendor");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_street_vendor");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource;
return dataSource;
} }
//////////////////////////////(For vending committe) ////////////////////////
////////////////////////////// (For vending committe) ////////////////////////
@Bean(name = "mysqlVendingCommitteDataSource") @Bean(name = "mysqlVendingCommitteDataSource")
public DataSource mysqlVendingCommitteDataSource() { public DataSource mysqlVendingCommitteDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/vendingcommitte");
dataSource.setUrl("jdbc:mysql://" + host + "/vendingcommitte");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource;
return dataSource;
} }
/////////////// Domestic Waste ///////////////////// /////////////// Domestic Waste /////////////////////
@Bean(name = "mysqlDomesticWasteDataSource") @Bean(name = "mysqlDomesticWasteDataSource")
public DataSource mysqlDomesticWasteDataSource() { public DataSource mysqlDomesticWasteDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/domestic_waste_management");
dataSource.setUrl("jdbc:mysql://" + host + "/domestic_waste_management");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource;
return dataSource;
} }
/////////////// Green committee ///////////////////// /////////////// Green committee /////////////////////
@Bean(name = "mysqlGreenCommitteeDataSource") @Bean(name = "mysqlGreenCommitteeDataSource")
public DataSource mysqlGreenCommitteeDataSource() { public DataSource mysqlGreenCommitteeDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/green_committee");
dataSource.setUrl("jdbc:mysql://" + host + "/green_committee");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource;
return dataSource;
} }
/////////////// SCP ///////////////////// /////////////// SCP /////////////////////
@Bean(name = "mysqlScpDataSource") @Bean(name = "mysqlScpDataSource")
public DataSource mysqlScpDataSource() { public DataSource mysqlScpDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_1913_siltcatchpit");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_1913_siltcatchpit");
dataSource.setUsername("root"); dataSource.setUsername("root");
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource;
return dataSource;
} }
////////////////////////////// ORACLE //////////////////////// ////////////////////////////// ORACLE ////////////////////////
@Bean(name = "oracleDataSource")
public DataSource oracleDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.OracleDriver");
dataSource.setUrl("jdbc:oracle:thin:@10.1.0.14:1521:chncorp");
dataSource.setUsername("FAS");
dataSource.setPassword("FAS");
return dataSource;
}
@Bean(name = "oracleDataSource")
public DataSource oracleDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.OracleDriver");
dataSource.setUrl("jdbc:oracle:thin:@10.1.0.14:1521:chncorp");
dataSource.setUsername("FAS");
dataSource.setPassword("FAS");
return dataSource;
}
} }

231
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/controller/FlagPoleApiController.java

@ -1,12 +1,8 @@
package in.gov.chennaicorporation.gccoffice.flagpole.controller; package in.gov.chennaicorporation.gccoffice.flagpole.controller;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Generated;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -17,8 +13,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import in.gov.chennaicorporation.gccoffice.cdwaste.service.OfficerService;
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
import in.gov.chennaicorporation.gccoffice.flagpole.service.FlagpoleSMSService;
import in.gov.chennaicorporation.gccoffice.flagpole.service.RdoService; import in.gov.chennaicorporation.gccoffice.flagpole.service.RdoService;
@RestController @RestController
@ -28,6 +24,9 @@ public class FlagPoleApiController {
@Autowired @Autowired
private RdoService rdoService; private RdoService rdoService;
@Autowired
private FlagpoleSMSService flagpoleSMSService;
private final RestTemplate restTemplate; private final RestTemplate restTemplate;
private final AppConfig appConfig; private final AppConfig appConfig;
@ -37,7 +36,7 @@ public class FlagPoleApiController {
this.appConfig = appConfig; this.appConfig = appConfig;
} }
// old
// new
// @GetMapping("/getAllDetails") // @GetMapping("/getAllDetails")
// public ResponseEntity<?> getAllRequestDetails( // public ResponseEntity<?> getAllRequestDetails(
// @RequestParam String userLogin, // @RequestParam String userLogin,
@ -49,6 +48,19 @@ public class FlagPoleApiController {
// rdoService.getAllRequestDetailsByUserLogin( // rdoService.getAllRequestDetailsByUserLogin(
// userLogin, startDate, endDate); // userLogin, startDate, endDate);
// // 🔥 Attach HISTORY per refid
// for (Map<String, Object> record : result) {
// String refid = (String) record.get("refid");
// // List<Map<String, Object>> history =
// // rdoService.getRequestHistoryByRefId(refid);
// List<Map<String, Object>> history =
// rdoService.getOfficerFeedbackHistoryByRefId(refid,
// userLogin);
// record.put("history", history);
// }
// return ResponseEntity.ok( // return ResponseEntity.ok(
// Map.of( // Map.of(
// "status", "success", // "status", "success",
@ -58,33 +70,79 @@ public class FlagPoleApiController {
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) // return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
// .body(
// .body(Map.of(
// "status", "error",
// "message", "Failed to fetch data",
// "error", e.getMessage()));
// }
// }
// @GetMapping("/getAllDetails")
// public ResponseEntity<?> getAllRequestDetails(
// @RequestParam String gccUserId,
// @RequestParam(required = false) String startDate,
// @RequestParam(required = false) String endDate) {
// try {
// // 🔥 Resolve username ONCE (backend trust)
// String username = rdoService.getUsernameByUserId(gccUserId);
// if (username == null) {
// throw new RuntimeException("Invalid gccUserId : " + gccUserId);
// }
// List<Map<String, Object>> result =
// rdoService.getAllRequestDetailsByUserLogin(
// gccUserId, startDate, endDate);
// // 🔥 Attach HISTORY per refid (dept-wise)
// for (Map<String, Object> record : result) {
// String refid = (String) record.get("refid");
// List<Map<String, Object>> history =
// rdoService.getOfficerFeedbackHistoryByRefId(
// refid, username);
// record.put("history", history);
// }
// return ResponseEntity.ok(
// Map.of( // Map.of(
// "status", "success",
// "count", result.size(),
// "data", result));
// } catch (Exception e) {
// e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
// .body(Map.of(
// "status", "error", // "status", "error",
// "message", "Failed to fetch data", // "message", "Failed to fetch data",
// "error", e.getMessage())); // "error", e.getMessage()));
// } // }
// } // }
// new
@GetMapping("/getAllDetails") @GetMapping("/getAllDetails")
public ResponseEntity<?> getAllRequestDetails( public ResponseEntity<?> getAllRequestDetails(
@RequestParam String userLogin,
@RequestParam String gccUserId,
@RequestParam(required = false) String startDate, @RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate) { @RequestParam(required = false) String endDate) {
try { try {
List<Map<String, Object>> result = rdoService.getAllRequestDetailsByUserLogin(
userLogin, startDate, endDate);
// 🔥 Attach HISTORY per refid
/* 🔥 Normalize input (username OR id → gccuserid) */
gccUserId = rdoService.resolveGccUserId(gccUserId);
List<Map<String, Object>> result = rdoService.getAllRequestDetailsByUserLogin(gccUserId,
startDate, endDate);
/* 🔥 Attach HISTORY per refid */
for (Map<String, Object> record : result) { for (Map<String, Object> record : result) {
String refid = (String) record.get("refid"); String refid = (String) record.get("refid");
// List<Map<String, Object>> history =
// rdoService.getRequestHistoryByRefId(refid);
List<Map<String, Object>> history = rdoService.getOfficerFeedbackHistoryByRefId(refid, List<Map<String, Object>> history = rdoService.getOfficerFeedbackHistoryByRefId(refid,
userLogin);
gccUserId);
record.put("history", history); record.put("history", history);
} }
@ -105,19 +163,41 @@ public class FlagPoleApiController {
} }
} }
// old
// @PostMapping("/rdo/updateDecision")
// public ResponseEntity<?> updateRdoDecision(
// @RequestParam String refid,
// @RequestParam String status,
// @RequestParam String remarks,
// @RequestParam String approvedBy) {
// int count = rdoService.updateRdoDecision(refid, status, remarks, approvedBy);
// if (count > 0) {
// return ResponseEntity.ok(Map.of(
// "status", "SUCCESS",
// "message", "Decision updated successfully"));
// } else {
// return ResponseEntity.badRequest().body(Map.of(
// "status", "FAILED",
// "message", "Unable to update decision"));
// }
// }
// @PostMapping("/rdo/updateDecision") // @PostMapping("/rdo/updateDecision")
// public ResponseEntity<?> updateRdoDecision( // public ResponseEntity<?> updateRdoDecision(
// @RequestParam String refid, // @RequestParam String refid,
// @RequestParam String status, // @RequestParam String status,
// @RequestParam String remarks, // @RequestParam String remarks,
// @RequestParam String approvedBy // 🔥 FROM JS
// ) {
// @RequestParam String gccUserId) {
// try {
// /* 🔥 Normalize username OR id → gccuserid */
// gccUserId = rdoService.resolveGccUserId(gccUserId);
// int count = rdoService.updateRdoDecision( // int count = rdoService.updateRdoDecision(
// refid,
// status,
// remarks,
// approvedBy);
// refid, status, remarks, gccUserId);
// if (count > 0) { // if (count > 0) {
// return ResponseEntity.ok(Map.of( // return ResponseEntity.ok(Map.of(
@ -128,25 +208,52 @@ public class FlagPoleApiController {
// "status", "FAILED", // "status", "FAILED",
// "message", "Unable to update decision")); // "message", "Unable to update decision"));
// } // }
// } catch (Exception e) {
// e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
// .body(Map.of(
// "status", "ERROR",
// "message", e.getMessage()));
// }
// } // }
@PostMapping("/rdo/updateDecision")
public ResponseEntity<?> updateRdoDecision(
@PostMapping("/officer/updateDecision")
public ResponseEntity<?> updateOfficerDecision(
@RequestParam String refid, @RequestParam String refid,
@RequestParam String status, @RequestParam String status,
@RequestParam String remarks, @RequestParam String remarks,
@RequestParam String approvedBy) {
@RequestParam String gccUserId,
@RequestParam String username) {
int count = rdoService.updateRdoDecision(refid, status, remarks, approvedBy);
try {
if (count > 0) {
return ResponseEntity.ok(Map.of(
"status", "SUCCESS",
"message", "Decision updated successfully"));
} else {
return ResponseEntity.badRequest().body(Map.of(
"status", "FAILED",
"message", "Unable to update decision"));
/* 🔥 Normalize username OR id → gccuserid */
gccUserId = rdoService.resolveGccUserId(gccUserId);
int count = rdoService.updateOfficerDecision(
refid,
status,
remarks,
gccUserId,
username);
if (count > 0) {
return ResponseEntity.ok(Map.of(
"status", "SUCCESS",
"message", "Decision updated successfully"));
} else {
return ResponseEntity.badRequest().body(Map.of(
"status", "FAILED",
"message", "Unable to update decision"));
}
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of(
"status", "ERROR",
"message", e.getMessage()));
} }
} }
@ -219,22 +326,65 @@ public class FlagPoleApiController {
// } // }
// } // }
// @GetMapping("/getApprovedAndRejectedDetails")
// public ResponseEntity<?> getApprovedRequestDetails(
// @RequestParam String userLogin,
// @RequestParam(required = false) String startDate,
// @RequestParam(required = false) String endDate) {
// try {
// List<Map<String, Object>> result =
// rdoService.getRdoApprovedRequestDetailsByUserLogin(
// userLogin, startDate, endDate, null);
// for (Map<String, Object> record : result) {
// String refid = (String) record.get("refid");
// // 🔥 NEW: officer feedback history
// List<Map<String, Object>> history =
// rdoService.getOfficerFeedbackHistoryByRefId(refid,
// userLogin);
// record.put("history", history);
// }
// return ResponseEntity.ok(Map.of(
// "status", "success",
// "count", result.size(),
// "data", result));
// } catch (Exception e) {
// e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
// .body(Map.of(
// "status", "error",
// "message", "Failed to fetch data",
// "error", e.getMessage()));
// }
// }
@GetMapping("/getApprovedAndRejectedDetails") @GetMapping("/getApprovedAndRejectedDetails")
public ResponseEntity<?> getApprovedRequestDetails( public ResponseEntity<?> getApprovedRequestDetails(
@RequestParam String userLogin,
@RequestParam String gccUserId,
@RequestParam(required = false) String startDate, @RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate) { @RequestParam(required = false) String endDate) {
try { try {
/* 🔥 Normalize username OR id → gccuserid */
gccUserId = rdoService.resolveGccUserId(gccUserId);
/* 🔥 Fetch approved & rejected records */
List<Map<String, Object>> result = rdoService.getRdoApprovedRequestDetailsByUserLogin( List<Map<String, Object>> result = rdoService.getRdoApprovedRequestDetailsByUserLogin(
userLogin, startDate, endDate, null);
gccUserId, startDate, endDate, null);
/* 🔥 Attach officer feedback history per refid */
for (Map<String, Object> record : result) { for (Map<String, Object> record : result) {
String refid = (String) record.get("refid"); String refid = (String) record.get("refid");
// 🔥 NEW: officer feedback history
List<Map<String, Object>> history = rdoService.getOfficerFeedbackHistoryByRefId(refid, List<Map<String, Object>> history = rdoService.getOfficerFeedbackHistoryByRefId(refid,
userLogin);
gccUserId);
record.put("history", history); record.put("history", history);
} }
@ -249,9 +399,14 @@ public class FlagPoleApiController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Map.of( .body(Map.of(
"status", "error", "status", "error",
"message", "Failed to fetch data",
"message", "Failed to fetch approved/rejected data",
"error", e.getMessage())); "error", e.getMessage()));
} }
} }
@GetMapping("/sendRejectMessage")
public void sendRejectMessage(@RequestParam String mobileNo, @RequestParam String refid) {
flagpoleSMSService.userrequestRejectedsms(mobileNo, refid);
}
} }

133
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/service/FlagpoleSMSService.java

@ -0,0 +1,133 @@
package in.gov.chennaicorporation.gccoffice.flagpole.service;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
import in.gov.chennaicorporation.gccoffice.flagpole.util.MessageUtility;
@Service
public class FlagpoleSMSService {
@Autowired
private AppConfig appConfig;
@Autowired
private MessageUtility messageUtility;
private final String key = "pfTEYN6H";
public String sendBookingSuccesssms(String mobileNo, String requestId) {
String message = "Your Flag Pole permission request has been submitted successfully. "
+ "Request ID: " + requestId
+ ". You will be notified once the status is updated. By GCC";
// Encode message and fix colon issue (gateway not decoding %3A)
String encodedMsg = URLEncoder.encode(message, StandardCharsets.UTF_8)
.replace("%3A", ":");
String urlString = appConfig.getOtpUrl()
+ "from=GCCCRP"
+ "&key=" + key
+ "&sender=GCCCRP"
+ "&to=" + mobileNo
+ "&body=" + encodedMsg
+ "&entityid=1401572690000011081"
+ "&templateid=1407176959297472163";
System.out.println("SMS URL:- " + urlString);
String response = messageUtility.sendSMS(urlString);
System.out.println("SMS RESPONSE:- " + response);
return response;
}
public String userrequestApprovedsms(String mobileNo, String requestId) {
String message = "Your Flag Pole permission request has been approved. "
+ "Request ID: " + requestId
+ ". Please proceed as per the permitted guidelines. By GCC";
// Encode message and fix colon issue (gateway not decoding %3A)
String encodedMsg = URLEncoder.encode(message, StandardCharsets.UTF_8)
.replace("%3A", ":");
String urlString = appConfig.getOtpUrl()
+ "from=GCCCRP"
+ "&key=" + key
+ "&sender=GCCCRP"
+ "&to=" + mobileNo
+ "&body=" + encodedMsg
+ "&entityid=1401572690000011081"
+ "&templateid=1407176959304753543";
System.out.println("SMS URL:- " + urlString);
String response = messageUtility.sendSMS(urlString);
System.out.println("SMS RESPONSE:- " + response);
return response;
}
// public String userrequestRejectedsms(String mobileNo, String requestId) {
// String message = "Your Flag Pole permission request has been rejected. "
// + "Request ID: " + requestId + ". "
// + "Review the details in the portal
// https://gccservices.in/flagpolesregistration/status\n"
// + "By GCC";
// // ONLY encode. Do NOT replace %3A
// String encodedMsg = URLEncoder.encode(message, StandardCharsets.UTF_8);
// String urlString = appConfig.getOtpUrl()
// + "from=GCCCRP"
// + "&key=" + key
// + "&sender=GCCCRP"
// + "&to=" + mobileNo
// + "&body=" + encodedMsg
// + "&entityid=1401572690000011081"
// + "&templateid=1407176959315374790";
// System.out.println("SMS URL:- " + urlString);
// String response = messageUtility.sendSMS(urlString);
// System.out.println("SMS RESPONSE:- " + response);
// return response;
// }
public String userrequestRejectedsms(String mobileNo, String requestId) {
System.out.println("Rejected Mob Num SMSSSSSSS = " + mobileNo);
String url = "https://gccservices.in/flagpolesregistration/status";
String message = "Your Flag Pole permission request has been rejected. Request ID: " + requestId
+ ". Review the details in the portal " + url + "\r\nBy GCC";
String encodedMsg = URLEncoder.encode(message, StandardCharsets.UTF_8);
System.out.println("encodedMsg:- " + encodedMsg);
String urlString = appConfig.getOtpUrl()
+ "from=GCCCRP"
+ "&key=" + key
// + "&sender=GCCCRP"
+ "&to=" + mobileNo
+ "&body=" + encodedMsg
+ "&entityid=1401572690000011081"
+ "&templateid=1407176959315374790";
System.out.println("SMS URL:- " + urlString);
String response = messageUtility.sendSMS(urlString);
System.out.println("SMS RESPONSE:- " + response);
return response;
}
}

1225
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/service/RdoService.java
File diff suppressed because it is too large
View File

45
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/service/WhatsappServiceFlagPole.java

@ -1,28 +1,31 @@
package in.gov.chennaicorporation.gccoffice.flagpole.service;
// package in.gov.chennaicorporation.gccoffice.flagpole.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.stereotype.Service;
@Service
public class WhatsappServiceFlagPole {
// @Service
// public class WhatsappServiceFlagPole {
@Autowired
private SmsServiceFlagPole smsService;
// @Autowired
// private SMSService smsService;
// c & d waste template after user register
public void sendOfficerApprovedWhatsappMessage(String refId, String mobileNumber) {
try {
// // c & d waste template after user register
// public void sendOfficerApprovedWhatsappMessage(String refId, String
// mobileNumber) {
// try {
String apiUrl = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
+ mobileNumber
+ "&v=1.1&format=json&msg_type=IMAGE&method=SENDMEDIAMESSAGE&caption=Welcome+to+Greater+Chennai+Corporation%2C+%0A%0AYour+Registered+ID+is+%2A${registerId}%2A+.%0AYour+C%26D+waste+registration+has+been+approved+successfully.+%0A%0AFor+downloading+your+ID+card%2C+kindly+click+on+the+button+below+%F0%9F%91%87&media_url=https%3A%2F%2Fres.cloudinary.com%2Fdpub5muar%2Fimage%2Fupload%2Fv1729597847%2Fq2ihjs99puhhwkjzajyo.png&isTemplate=true&buttonUrlParam=userdetail%3Fregister_id%3D"
+ refId;
// String apiUrl =
// "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
// + mobileNumber
// +
// "&v=1.1&format=json&msg_type=IMAGE&method=SENDMEDIAMESSAGE&caption=Welcome+to+Greater+Chennai+Corporation%2C+%0A%0AYour+Registered+ID+is+%2A${registerId}%2A+.%0AYour+C%26D+waste+registration+has+been+approved+successfully.+%0A%0AFor+downloading+your+ID+card%2C+kindly+click+on+the+button+below+%F0%9F%91%87&media_url=https%3A%2F%2Fres.cloudinary.com%2Fdpub5muar%2Fimage%2Fupload%2Fv1729597847%2Fq2ihjs99puhhwkjzajyo.png&isTemplate=true&buttonUrlParam=userdetail%3Fregister_id%3D"
// + refId;
System.out.println("WhatsApp API URL: " + apiUrl); // Optional debug
smsService.sendMsg(apiUrl);
// System.out.println("WhatsApp API URL: " + apiUrl); // Optional debug
// smsService.sendMsg(apiUrl);
} catch (Exception e) {
e.printStackTrace();
}
}
}
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }

41
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/flagpole/util/MessageUtility.java

@ -0,0 +1,41 @@
package in.gov.chennaicorporation.gccoffice.flagpole.util;
import java.net.HttpURLConnection;
import java.net.URL;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class MessageUtility {
public String sendMsg(String msgUrl) {
System.out.println("Whatsapp URL :-" + msgUrl);
String response = "";
try {
HttpURLConnection connection = null;
URL url = new URL(msgUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
response = responseCode + "";
System.out.println("Response Code: " + responseCode);
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
public String sendSMS(String SMS_Url) {
// System.out.println("SMS URL:- " + SMS_Url);
RestTemplate restTemplate = new RestTemplate();
String response = restTemplate.getForObject(SMS_Url, String.class);
return response;
}
}

4
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/service/PendinglistService.java

@ -19,6 +19,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder; import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class PendinglistService { public class PendinglistService {
@ -405,6 +406,7 @@ public class PendinglistService {
} }
} }
@Transactional
public Map<String, Object> saveReInspection(String refId, int action, int meetingId, public Map<String, Object> saveReInspection(String refId, int action, int meetingId,
String remarks, int userId) { String remarks, int userId) {
@ -433,6 +435,8 @@ public class PendinglistService {
// Update reg_details.reinspection_id // Update reg_details.reinspection_id
jdbcTemplate.update("UPDATE reg_details SET reinspection_id=? WHERE ref_id=?",generatedId, refId); jdbcTemplate.update("UPDATE reg_details SET reinspection_id=? WHERE ref_id=?",generatedId, refId);
jdbcTemplate.update("UPDATE inspection_data SET isactive=0,isdelete=1 WHERE ref_id=?", refId);
response.put("status", "success"); response.put("status", "success");
response.put("message", "Committee decision saved!"); response.put("message", "Committee decision saved!");
response.put("reinspection_id", generatedId); response.put("reinspection_id", generatedId);

3
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java

@ -488,10 +488,11 @@ public class NulmAPIController {
public ResponseEntity<List<Map<String, Object>>> getAttendanceWithInitiatedSalaryByGroupId( public ResponseEntity<List<Map<String, Object>>> getAttendanceWithInitiatedSalaryByGroupId(
@RequestParam(value = "inchargeId", required = false) Integer inchargeId, @RequestParam(value = "inchargeId", required = false) Integer inchargeId,
@RequestParam(value = "month", required = false) String month, @RequestParam(value = "month", required = false) String month,
@RequestParam(value = "year", required = false) String year,
@RequestParam(value = "incharge_name", required = false) String inchargeName, @RequestParam(value = "incharge_name", required = false) String inchargeName,
@RequestParam (value = "enrollmentIds", required = false) List<Integer> enrollmentIds) { @RequestParam (value = "enrollmentIds", required = false) List<Integer> enrollmentIds) {
List<Map<String, Object>> staffList = nulmService.getAttendanceWithInitiatedSalary(inchargeId, month, inchargeName, enrollmentIds);
List<Map<String, Object>> staffList = nulmService.getAttendanceWithInitiatedSalary(inchargeId, month, year, inchargeName, enrollmentIds);
return ResponseEntity.ok(staffList); return ResponseEntity.ok(staffList);
} }
/* /*

9
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java

@ -1176,7 +1176,7 @@ public class NulmService {
*/ */
public List<Map<String, Object>> getAttendanceWithInitiatedSalary( public List<Map<String, Object>> getAttendanceWithInitiatedSalary(
int inchargeId, String month, String inchargeName, List<Integer> enrollmentIds) {
int inchargeId, String month, String year, String inchargeName, List<Integer> enrollmentIds) {
String sql = "SELECT " + String sql = "SELECT " +
"e.group_id, " + "e.group_id, " +
@ -1207,6 +1207,10 @@ public class NulmService {
if (month != null && !month.isEmpty()) { if (month != null && !month.isEmpty()) {
sql += "AND MONTHNAME(COALESCE(a.indatetime, a.leavedatetime, a.oddatetime)) = ? "; sql += "AND MONTHNAME(COALESCE(a.indatetime, a.leavedatetime, a.oddatetime)) = ? ";
} }
if (year != null && !year.isEmpty()) {
sql += "AND YEAR(COALESCE(a.indatetime, a.leavedatetime, a.oddatetime)) = ? ";
}
// Assuming enrollmentIds is a List<String> or List<Integer> // Assuming enrollmentIds is a List<String> or List<Integer>
StringBuilder placeholders = new StringBuilder(); StringBuilder placeholders = new StringBuilder();
@ -1240,6 +1244,9 @@ public class NulmService {
if (month != null && !month.isEmpty()) { if (month != null && !month.isEmpty()) {
params.add(month); params.add(month);
} }
if (year != null && !year.isEmpty()) {
params.add(year);
}
params.addAll(enrollmentIds); params.addAll(enrollmentIds);

4
gcc_officer_portal/src/main/resources/application.properties

@ -1,5 +1,5 @@
#spring.profiles.active=local
spring.profiles.active=production
spring.profiles.active=local
# spring.profiles.active=production
#For Server production #For Server production
#assets.base-url=/gcc/assets/ #assets.base-url=/gcc/assets/
#For local test #For local test

4
gcc_officer_portal/src/main/resources/templates/modules/callcenterqaqc/socialmediacomplaints.html

@ -615,7 +615,7 @@
<select class="form-control" id="action"> <select class="form-control" id="action">
<option value="">Select</option> <option value="">Select</option>
<option value="COMPLETED">COMPLETED</option> <option value="COMPLETED">COMPLETED</option>
<option value="REOPENED">REOPEN</option>
<option value="REOPEN">REOPEN</option>
</select> </select>
</td>` </td>`
: '-'; : '-';
@ -1037,7 +1037,7 @@
return; // Stop execution if no action is selected return; // Stop execution if no action is selected
} }
if (actionValue === "REOPENED" && remarksValue.trim() === "") {
if (actionValue === "REOPEN" && remarksValue.trim() === "") {
Swal.fire({ Swal.fire({
icon: 'warning', icon: 'warning',
title: 'Remarks Required', title: 'Remarks Required',

31
gcc_officer_portal/src/main/resources/templates/modules/flagpole/approvedandrejectedlist.html

@ -141,7 +141,7 @@
<h3 class="mb-0">Temporary Flag Poles - Approved & Rejected List : <span <h3 class="mb-0">Temporary Flag Poles - Approved & Rejected List : <span
th:text="${officer_name}"></span></h3> th:text="${officer_name}"></span></h3>
<input type="hidden" id="userName" th:value="${officer_name}"> <input type="hidden" id="userName" th:value="${officer_name}">
<input type="hidden" id="loginuserid" th:value="${LoginUserId}">
</div> </div>
@ -314,11 +314,14 @@
function loadTable() { function loadTable() {
let officer_name = $("#userName").val();
//let officer_name = $("#userName").val();
let gccUserId = $("#loginuserid").val();
let startDate = $("#startDate").val(); let startDate = $("#startDate").val();
let endDate = $("#endDate").val(); let endDate = $("#endDate").val();
let status = $("#statusFilter").val(); let status = $("#statusFilter").val();
console.log("gccuserid", gccUserId);
if ($.fn.DataTable.isDataTable('#QaqcDatatable')) { if ($.fn.DataTable.isDataTable('#QaqcDatatable')) {
$('#QaqcDatatable').DataTable().clear().destroy(); $('#QaqcDatatable').DataTable().clear().destroy();
} }
@ -333,7 +336,8 @@
url: "/gcc/api/flagpoleregistration/getApprovedAndRejectedDetails", url: "/gcc/api/flagpoleregistration/getApprovedAndRejectedDetails",
type: "GET", type: "GET",
data: { data: {
userLogin: officer_name,
//userLogin: officer_name,
gccUserId: gccUserId,
startDate: startDate, startDate: startDate,
endDate: endDate, endDate: endDate,
status: status status: status
@ -347,9 +351,10 @@
data.forEach(r => { data.forEach(r => {
let status = r.history && r.history.length > 0 let status = r.history && r.history.length > 0
? r.history[0].status
? r.history[r.history.length - 1].status
: null; : null;
if (!status) pending++; if (!status) pending++;
else if (status === 'APPROVED') approved++; else if (status === 'APPROVED') approved++;
else if (status === 'REJECTED') rejected++; else if (status === 'REJECTED') rejected++;
@ -423,9 +428,10 @@
render: row => { render: row => {
let status = row.history && row.history.length > 0 let status = row.history && row.history.length > 0
? row.history[0].status
? row.history[row.history.length - 1].status
: null; : null;
if (!status) if (!status)
return `<span class="badge bg-warning text-dark">Pending</span>`; return `<span class="badge bg-warning text-dark">Pending</span>`;
if (status === 'APPROVED') if (status === 'APPROVED')
@ -563,7 +569,7 @@
record.history.forEach((h, index) => { record.history.forEach((h, index) => {
historyHtml += ` historyHtml += `
<div class="row mb-2 border-bottom pb-2"> <div class="row mb-2 border-bottom pb-2">
<div class="col-md-4">
<div class="col-md-3">
<div class="label-text">Action Date</div> <div class="label-text">Action Date</div>
<div class="value-text">${h.action_date}</div> <div class="value-text">${h.action_date}</div>
</div> </div>
@ -574,22 +580,15 @@
</div> </div>
<div class="col-md-2">
<div class="col-md-3">
<div class="label-text">Status</div> <div class="label-text">Status</div>
<div class="value-text">${h.status}</div> <div class="value-text">${h.status}</div>
</div> </div>
<div class="col-md-2">
<div class="label-text">RDO Status</div>
<div class="value-text">
${record.rdo_status || "-"}
</div>
</div>
${h.remarks ? ` ${h.remarks ? `
<div class="col-md-2 mt-1">
<div class="col-md-3">
<div class="label-text">Remarks</div> <div class="label-text">Remarks</div>
<div class="value-text">${h.remarks}</div> <div class="value-text">${h.remarks}</div>
</div>` : ""} </div>` : ""}

549
gcc_officer_portal/src/main/resources/templates/modules/flagpole/requestlist.html

@ -139,6 +139,7 @@
<h3 class="mb-0">Temporary Flag Poles - Request List : <span <h3 class="mb-0">Temporary Flag Poles - Request List : <span
th:text="${officer_name}"></span></h3> th:text="${officer_name}"></span></h3>
<input type="hidden" id="userName" th:value="${officer_name}"> <input type="hidden" id="userName" th:value="${officer_name}">
<input type="hidden" id="loginuserid" th:value="${LoginUserId}">
</div> </div>
<div class="row mt-3 ml-2"> <div class="row mt-3 ml-2">
@ -277,6 +278,20 @@
<div class="modal fade" id="imagePreviewModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Document Preview</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body text-center">
<img id="previewImage" class="img-fluid">
</div>
</div>
</div>
</div>
<script th:replace="~{fragments/modules/base/script :: script}"></script> <script th:replace="~{fragments/modules/base/script :: script}"></script>
@ -297,12 +312,132 @@
}); });
}); });
$(document).on("click", ".zoom-img", function () {
const src = $(this).data("src");
$("#previewImage").attr("src", src);
$("#imagePreviewModal").modal("show");
});
// function loadTable() {
// let officer_name = $("#userName").val();
// let startDate = $("#startDate").val();
// let endDate = $("#endDate").val();
// if ($.fn.DataTable.isDataTable('#QaqcDatatable')) {
// $('#QaqcDatatable').DataTable().clear().destroy();
// }
// table = $('#QaqcDatatable').DataTable({
// processing: true,
// responsive: true,
// scrollY: '50vh',
// dom: 'Bfrtip', // 🔥 ENABLE BUTTONS
// ajax: {
// url: "/gcc/api/flagpoleregistration/getAllDetails",
// type: "GET",
// data: {
// userLogin: officer_name,
// startDate: startDate,
// endDate: endDate
// },
// dataSrc: function (json) {
// const data = json.data || [];
// // 🔹 Dashboard counts
// let pending = 0, approved = 0, rejected = 0;
// data.forEach(r => {
// if (!r.rdo_status) pending++;
// else if (r.rdo_status === 'APPROVED') approved++;
// else if (r.rdo_status === 'REJECTED') rejected++;
// });
// $("#totalrequest").text(data.length);
// $("#pendingdecision").text(pending);
// $("#approved").text(approved);
// $("#rejected").text(rejected);
// return data; // ✅ already unique per refid
// }
// },
// columns: [
// {
// data: null,
// className: "text-center",
// render: (d, t, r, m) => m.row + 1
// },
// {
// data: "applicant_name",
// className: "text-center"
// },
// {
// data: "refid",
// className: "text-center"
// },
// {
// data: null,
// className: "text-center",
// render: row => {
// if (!row.streets || row.streets.length === 0) return "-";
// return `${row.streets[0].zone} / ${row.streets[0].ward}`;
// }
// },
// {
// data: "event_name",
// className: "text-center"
// },
// {
// data: "event_date",
// className: "text-center",
// render: d => new Date(d).toLocaleDateString("en-GB")
// },
// {
// data: "total_cost",
// className: "text-center",
// render: d => d.toLocaleString("en-GB")
// },
// {
// data: "rdo_status",
// className: "text-center",
// render: d => {
// if (!d)
// return `<span class="badge bg-warning text-dark">Pending</span>`;
// if (d === 'APPROVED')
// return `<span class="badge bg-success">Approved</span>`;
// return `<span class="badge bg-danger">Rejected</span>`;
// }
// },
// {
// data: null,
// className: "text-center",
// render: row =>
// `<button class="btn btn-primary btn-sm viewBtn"
// data-refid="${row.refid}">
// View
// </button>`
// }
// ]
// });
// }
function loadTable() { function loadTable() {
let officer_name = $("#userName").val();
let gccUserId = $("#loginuserid").val();
let startDate = $("#startDate").val(); let startDate = $("#startDate").val();
let endDate = $("#endDate").val(); let endDate = $("#endDate").val();
console.log("gccuserid:" + gccUserId);
if ($.fn.DataTable.isDataTable('#QaqcDatatable')) { if ($.fn.DataTable.isDataTable('#QaqcDatatable')) {
$('#QaqcDatatable').DataTable().clear().destroy(); $('#QaqcDatatable').DataTable().clear().destroy();
} }
@ -311,13 +446,13 @@
processing: true, processing: true,
responsive: true, responsive: true,
scrollY: '50vh', scrollY: '50vh',
dom: 'Bfrtip', // 🔥 ENABLE BUTTONS
dom: 'Bfrtip',
ajax: { ajax: {
url: "/gcc/api/flagpoleregistration/getAllDetails", url: "/gcc/api/flagpoleregistration/getAllDetails",
type: "GET", type: "GET",
data: { data: {
userLogin: officer_name,
gccUserId: gccUserId,
startDate: startDate, startDate: startDate,
endDate: endDate endDate: endDate
}, },
@ -325,50 +460,47 @@
const data = json.data || []; const data = json.data || [];
// 🔹 Dashboard counts
let pending = 0, approved = 0, rejected = 0; let pending = 0, approved = 0, rejected = 0;
// data.forEach(r => {
// if (!r.rdo_status) pending++;
// else if (r.rdo_status === 'APPROVED') approved++;
// else if (r.rdo_status === 'REJECTED') rejected++;
// });
data.forEach(r => { data.forEach(r => {
if (!r.rdo_status) pending++;
else if (r.rdo_status === 'APPROVED') approved++;
else if (r.rdo_status === 'REJECTED') rejected++;
const status = r.final_status;
if (!status) pending++;
else if (status === 'APPROVED') approved++;
else if (status === 'REJECTED') rejected++;
}); });
$("#totalrequest").text(data.length); $("#totalrequest").text(data.length);
$("#pendingdecision").text(pending); $("#pendingdecision").text(pending);
$("#approved").text(approved); $("#approved").text(approved);
$("#rejected").text(rejected); $("#rejected").text(rejected);
return data; // ✅ already unique per refid
return data;
} }
}, },
columns: [ columns: [
{ data: null, render: (d, t, r, m) => m.row + 1, className: "text-center" },
{ data: "applicant_name", className: "text-center" },
{ data: "refid", className: "text-center" },
{ {
data: null, data: null,
className: "text-center", className: "text-center",
render: (d, t, r, m) => m.row + 1
},
{
data: "applicant_name",
className: "text-center"
},
{
data: "refid",
className: "text-center"
},
{
data: null,
className: "text-center",
render: row => {
if (!row.streets || row.streets.length === 0) return "-";
return `${row.streets[0].zone} / ${row.streets[0].ward}`;
}
},
{
data: "event_name",
className: "text-center"
render: r =>
r.streets?.length
? `${r.streets[0].zone} / ${r.streets[0].ward}`
: "-"
}, },
{ data: "event_name", className: "text-center" },
{ {
data: "event_date", data: "event_date",
className: "text-center", className: "text-center",
@ -379,31 +511,47 @@
className: "text-center", className: "text-center",
render: d => d.toLocaleString("en-GB") render: d => d.toLocaleString("en-GB")
}, },
// {
// data: "rdo_status",
// className: "text-center",
// render: d =>
// !d
// ? `<span class="badge bg-warning text-dark">Pending</span>`
// : d === 'APPROVED'
// ? `<span class="badge bg-success">Approved</span>`
// : `<span class="badge bg-danger">Rejected</span>`
// },
{ {
data: "rdo_status",
data: null,
className: "text-center", className: "text-center",
render: d => {
if (!d)
render: r => {
const status = r.final_status;
if (!status)
return `<span class="badge bg-warning text-dark">Pending</span>`; return `<span class="badge bg-warning text-dark">Pending</span>`;
if (d === 'APPROVED')
else if (status === 'APPROVED')
return `<span class="badge bg-success">Approved</span>`; return `<span class="badge bg-success">Approved</span>`;
return `<span class="badge bg-danger">Rejected</span>`;
else
return `<span class="badge bg-danger">Rejected</span>`;
} }
}, },
{ {
data: null, data: null,
className: "text-center", className: "text-center",
render: row =>
render: r =>
`<button class="btn btn-primary btn-sm viewBtn" `<button class="btn btn-primary btn-sm viewBtn"
data-refid="${row.refid}">
data-refid="${r.refid}">
View View
</button>`
</button>`
} }
] ]
}); });
} }
// 🔹 View button action // 🔹 View button action
// Destroy previous instance if exists // Destroy previous instance if exists
@ -429,6 +577,9 @@
}); });
function populateModal(record) { function populateModal(record) {
// HEADER // HEADER
@ -444,47 +595,47 @@
record.streets.forEach((s, i) => { record.streets.forEach((s, i) => {
streetHtml += ` streetHtml += `
<div class="card-section">
<div class="section-title">Street ${i + 1}</div>
<div class="card-section">
<div class="section-title">Street ${i + 1}</div>
<div class="row mb-2">
<div class="col-md-4">
<div class="label-text">Street Name</div>
<div class="value-text">${s.street_name}</div>
</div>
<div class="col-md-4">
<div class="label-text">Zone</div>
<div class="value-text">${s.zone}</div>
</div>
<div class="col-md-4">
<div class="label-text">Ward</div>
<div class="value-text">${s.ward}</div>
</div>
<div class="col-md-4">
<div class="label-text">No. of Poles</div>
<div class="value-text">${s.no_of_poles}</div>
</div>
<div class="col-md-4">
<div class="label-text">Height</div>
<div class="value-text">${s.height}</div>
</div>
<div class="row mb-2">
<div class="col-md-4">
<div class="label-text">Street Name</div>
<div class="value-text">${s.street_name}</div>
</div>
<div class="col-md-4">
<div class="label-text">Zone</div>
<div class="value-text">${s.zone}</div>
</div>
<div class="col-md-4">
<div class="label-text">Ward</div>
<div class="value-text">${s.ward}</div>
</div>
<div class="col-md-4">
<div class="label-text">No. of Poles</div>
<div class="value-text">${s.no_of_poles}</div>
</div>
<div class="col-md-4">
<div class="label-text">Height</div>
<div class="value-text">${s.height}</div>
</div>
<div class="col-md-4">
<div class="label-text">Flag Material</div>
<div class="value-text">${s.flag_material}</div>
</div>
<div class="col-md-4">
<div class="label-text">Pole Material</div>
<div class="value-text">${s.pole_material}</div>
</div>
<div class="col-md-4">
<div class="label-text">Flag Material</div>
<div class="value-text">${s.flag_material}</div>
</div>
<div class="col-md-4">
<div class="label-text">Pole Material</div>
<div class="value-text">${s.pole_material}</div>
</div> </div>
</div>
</div>`;
</div>`;
}); });
let historyHtml = ""; let historyHtml = "";
@ -492,46 +643,38 @@
if (record.history && record.history.length > 0) { if (record.history && record.history.length > 0) {
historyHtml += ` historyHtml += `
<div class="card-section">
<div class="section-title">Application History</div>
`;
<div class="card-section">
<div class="section-title">Application History</div>
`;
record.history.forEach((h, index) => { record.history.forEach((h, index) => {
historyHtml += ` historyHtml += `
<div class="row mb-2 border-bottom pb-2">
<div class="col-md-4">
<div class="label-text">Action Date</div>
<div class="value-text">${h.action_date}</div>
</div>
<div class="col-md-3">
<div class="label-text">Department</div>
<div class="value-text">${h.department_name}</div>
</div>
<div class="row mb-2 border-bottom pb-2">
<div class="col-md-3">
<div class="label-text">Action Date</div>
<div class="value-text">${h.action_date}</div>
</div>
<div class="col-md-3">
<div class="label-text">Department</div>
<div class="value-text">${h.department_name}</div>
</div>
<div class="col-md-2">
<div class="label-text">Status</div>
<div class="value-text">${h.status}</div>
</div>
<div class="col-md-2">
<div class="label-text">RDO Status</div>
<div class="value-text">
${record.rdo_status || "-"}
<div class="col-md-3">
<div class="label-text">Status</div>
<div class="value-text">${h.status}</div>
</div> </div>
</div>
${h.remarks ? `
<div class="col-md-12 mt-1">
<div class="label-text">Remarks</div>
<div class="value-text">${h.remarks}</div>
</div>` : ""}
</div>
`;
${h.remarks ? `
<div class="col-md-3">
<div class="label-text">Remarks</div>
<div class="value-text">${h.remarks}</div>
</div>` : ""}
</div>
`;
}); });
historyHtml += `</div>`; historyHtml += `</div>`;
@ -540,90 +683,90 @@
let decisionHtml = ""; let decisionHtml = "";
// 🔹 Show decision buttons ONLY if pending // 🔹 Show decision buttons ONLY if pending
if (!record.rdo_status) {
if (!record.final_status) {
decisionHtml = ` decisionHtml = `
<div class="rdo-box">
<div class="section-title">Department Decision</div>
<div class="rdo-box">
<div class="section-title">Department Decision</div>
<textarea id="rdoRemarks" class="form-control mb-3"
rows="4" placeholder="Enter remarks..."></textarea>
<textarea id="rdoRemarks" class="form-control mb-3"
rows="4" placeholder="Enter remarks..."></textarea>
<div class="d-flex justify-content-between">
<button class="btn btn-success btn-big"
onclick="submitRdoDecision('APPROVED')">Approve</button>
<div class="d-flex justify-content-between">
<button class="btn btn-success btn-big"
onclick="submitOfficerDecision('APPROVED')">Approve</button>
<button class="btn btn-danger btn-big"
onclick="submitRdoDecision('REJECTED')">Reject</button>
</div>
</div>`;
<button class="btn btn-danger btn-big"
onclick="submitOfficerDecision('REJECTED')">Reject</button>
</div>
</div>`;
} }
let html = ` let html = `
<div class="card-section">
<div class="section-title">Applicant Information</div>
<div class="card-section">
<div class="section-title">Applicant Information</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="label-text">Applicant Name</div>
<div class="value-text">${record.applicant_name}</div>
</div>
<div class="col-md-6">
<div class="label-text">Mobile Number</div>
<div class="value-text">${record.mobile_number}</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="label-text">Applicant Name</div>
<div class="value-text">${record.applicant_name}</div>
</div>
<div class="col-md-6">
<div class="label-text">Mobile Number</div>
<div class="value-text">${record.mobile_number}</div>
</div>
</div> </div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="label-text">Event Type</div>
<div class="value-text">${record.event_name}</div>
</div>
<div class="col-md-6">
<div class="label-text">Event Date</div>
<div class="value-text">
${new Date(record.event_date).toLocaleDateString("en-GB")}
<div class="row mb-2">
<div class="col-md-6">
<div class="label-text">Event Type</div>
<div class="value-text">${record.event_name}</div>
</div> </div>
</div>
<div class="col-md-6">
<div class="label-text">Address</div>
<div class="value-text">
${record.applicant_address}
<div class="col-md-6">
<div class="label-text">Event Date</div>
<div class="value-text">
${new Date(record.event_date).toLocaleDateString("en-GB")}
</div>
</div> </div>
</div>
<div class="col-md-6">
<div class="label-text">Total Cost</div>
<div class="value-text">
${record.total_cost.toLocaleString("en-GB")}
<div class="col-md-6">
<div class="label-text">Address</div>
<div class="value-text">
${record.applicant_address}
</div>
</div>
<div class="col-md-6">
<div class="label-text">Total Cost</div>
<div class="value-text">
${record.total_cost.toLocaleString("en-GB")}
</div>
</div>
<div class="col-md-6">
<div class="label-text">No. of Days</div>
<div class="value-text">${record.no_of_days}</div>
</div>
<div class="col-md-6">
<div class="label-text">Event Description</div>
<div class="value-text">${record.event_desc}</div>
</div> </div>
</div>
<div class="col-md-6">
<div class="label-text">No. of Days</div>
<div class="value-text">${record.no_of_days}</div>
</div>
<div class="col-md-6">
<div class="label-text">Event Description</div>
<div class="value-text">${record.event_desc}</div>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="label-text">Applied Date</div>
<div class="value-text">${record.cdate}</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="label-text">Applied Date</div>
<div class="value-text">${record.cdate}</div>
</div>
</div> </div>
</div> </div>
</div>
${streetHtml}
${historyHtml}
${decisionHtml}
`;
${streetHtml}
${historyHtml}
${decisionHtml}
`;
@ -633,11 +776,76 @@
function submitRdoDecision(status) {
// function submitRdoDecision(status) {
// let remarks = ($("#rdoRemarks").val() || "").trim();
// let refid = $("#detailsModal").data("refid");
// let gccUserId = $("#loginuserid").val(); // 🔥 ONLY THIS
// //let approvedBy = $("#userName").val(); // 🔥 FROM HIDDEN INPUT
// if (!remarks) {
// Swal.fire({
// icon: 'warning',
// title: 'Remarks Required',
// text: 'Please enter remarks before submitting'
// });
// return;
// }
// Swal.fire({
// title: `Are you sure?`,
// text: `You want to ${status.toLowerCase()} this request`,
// icon: status === 'APPROVED' ? 'success' : 'error',
// showCancelButton: true,
// confirmButtonColor: status === 'APPROVED' ? '#28a745' : '#dc3545',
// cancelButtonColor: '#6c757d',
// confirmButtonText: `Yes, ${status}`
// }).then((result) => {
// if (!result.isConfirmed) return;
// $.ajax({
// url: "/gcc/api/flagpoleregistration/rdo/updateDecision",
// type: "POST",
// data: {
// refid: refid,
// status: status,
// remarks: remarks,
// gccUserId: gccUserId
// //approvedBy: approvedBy // 🔥 PASS TO BACKEND
// },
// success: function (res) {
// Swal.fire({
// icon: 'success',
// title: status === 'APPROVED' ? 'Approved!' : 'Rejected!',
// text: res.message || `Request has been ${status.toLowerCase()}`,
// timer: 2000,
// showConfirmButton: false
// });
// $("#detailsModal").modal("hide");
// $("#QaqcDatatable").DataTable().ajax.reload(null, false);
// },
// error: function () {
// Swal.fire({
// icon: 'error',
// title: 'Error',
// text: 'Failed to update decision'
// });
// }
// });
// });
// }
function submitOfficerDecision(status) {
let remarks = ($("#rdoRemarks").val() || "").trim(); let remarks = ($("#rdoRemarks").val() || "").trim();
let refid = $("#detailsModal").data("refid"); let refid = $("#detailsModal").data("refid");
let approvedBy = $("#userName").val(); // 🔥 FROM HIDDEN INPUT
let gccUserId = $("#loginuserid").val(); // login user id
let username = $("#userName").val(); // display username
if (!remarks) { if (!remarks) {
Swal.fire({ Swal.fire({
@ -661,13 +869,14 @@
if (!result.isConfirmed) return; if (!result.isConfirmed) return;
$.ajax({ $.ajax({
url: "/gcc/api/flagpoleregistration/rdo/updateDecision",
url: "/gcc/api/flagpoleregistration/officer/updateDecision",
type: "POST", type: "POST",
data: { data: {
refid: refid, refid: refid,
status: status, status: status,
remarks: remarks, remarks: remarks,
approvedBy: approvedBy // 🔥 PASS TO BACKEND
gccUserId: gccUserId,
username: username // ✅ NEW
}, },
success: function (res) { success: function (res) {

1
gcc_officer_portal/src/main/resources/templates/modules/m_petition/complaint_list.html

@ -74,6 +74,7 @@
<label for="searchyear">Select Year</label> <label for="searchyear">Select Year</label>
<select class="form-control" name="searchyear" id="searchyear" required=""> <select class="form-control" name="searchyear" id="searchyear" required="">
<option value="" selected="" disabled="">Select Year</option> <option value="" selected="" disabled="">Select Year</option>
<option value="2026">2026</option>
<option value="2025">2025</option> <option value="2025">2025</option>
<option value="2024">2024</option> <option value="2024">2024</option>
<option value="2023">2023</option> <option value="2023">2023</option>

1
gcc_officer_portal/src/main/resources/templates/modules/m_petition/petition_list.html

@ -74,6 +74,7 @@
<label for="searchyear">Select Year</label> <label for="searchyear">Select Year</label>
<select class="form-control" name="searchyear" id="searchyear" required=""> <select class="form-control" name="searchyear" id="searchyear" required="">
<option value="" selected="" disabled="">Select Year</option> <option value="" selected="" disabled="">Select Year</option>
<option value="2026">2026</option>
<option value="2025">2025</option> <option value="2025">2025</option>
<option value="2024">2024</option> <option value="2024">2024</option>
<option value="2023">2023</option> <option value="2023">2023</option>

3
gcc_officer_portal/src/main/resources/templates/modules/nulm/salary-approve.html

@ -101,6 +101,7 @@
<a href="#" class="total-staff-count" <a href="#" class="total-staff-count"
th:data-incharge-id="${salaryInitiatedCounts.incharge_id}" th:data-incharge-id="${salaryInitiatedCounts.incharge_id}"
th:data-month="${salaryInitiatedCounts.month}" th:data-month="${salaryInitiatedCounts.month}"
th:data-year="${salaryInitiatedCounts.year}"
th:data-incharge-name="${salaryInitiatedCounts.incharge_name}" th:data-incharge-name="${salaryInitiatedCounts.incharge_name}"
th:data-zone="${salaryInitiatedCounts.zone}" th:data-zone="${salaryInitiatedCounts.zone}"
th:data-enrollment-ids="${salaryInitiatedCounts.enrollment_ids}" th:data-enrollment-ids="${salaryInitiatedCounts.enrollment_ids}"
@ -282,6 +283,7 @@
// var inchargeName = $(this).data('incharge-name'); // var inchargeName = $(this).data('incharge-name');
var inchargeId = $(this).data('incharge-id') var inchargeId = $(this).data('incharge-id')
var month = $(this).data('month') var month = $(this).data('month')
var year = $(this).data('year')
var inchargeName = $(this).data('incharge-name') var inchargeName = $(this).data('incharge-name')
var zone = $(this).data('zone'); var zone = $(this).data('zone');
var enrollmentIds = $(this).data('enrollment-ids'); var enrollmentIds = $(this).data('enrollment-ids');
@ -295,6 +297,7 @@
//inchargeName: inchargeName, //inchargeName: inchargeName,
inchargeId: inchargeId, inchargeId: inchargeId,
month: month, month: month,
year: year,
inchargeName: inchargeName, inchargeName: inchargeName,
enrollmentIds: enrollmentIds.join(',') enrollmentIds: enrollmentIds.join(',')
}, },

Loading…
Cancel
Save