Browse Source

New Module`s Added

Date : 05-02-2025
main
Balaji 2 years ago
parent
commit
96e8d8c0c5
  1. BIN
      .DS_Store
  2. BIN
      mobileservice/.DS_Store
  3. BIN
      mobileservice/src/.DS_Store
  4. BIN
      mobileservice/src/main/.DS_Store
  5. BIN
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/1_approved.jpg
  6. BIN
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/1_rejected.jpg
  7. 20
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java
  8. 16
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccactivity/service/Activity.java
  9. 28
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccparks/controller/ParksController.java
  10. 133
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccparks/service/ParksService.java
  11. 109
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccschools/controller/SchoolUserController.java
  12. 243
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccschools/service/SchoolUserActivity.java
  13. 297
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/controller/APIHoardingsController.java
  14. 1
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/controller/package-info.java
  15. 1
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/package-info.java
  16. 1956
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/services/HoardingsService.java
  17. 1
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/services/package-info.java
  18. 9
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/nulm/controller/APINULMOfficerController.java
  19. 29
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/nulm/service/NULMOfficerActivity.java
  20. 79
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/controller/APICattleCatchController.java
  21. 14
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/controller/APIPenaltyControllerPOS.java
  22. 791
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/service/CattleCatchService.java
  23. 196
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/service/PenaltyServicePOS.java
  24. 6
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/service/OfficialAPIService.java
  25. 18
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/swmbwg/controller/APIController.java
  26. 78
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/swmbwg/service/activity.java
  27. 143
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/controller/APIController.java
  28. 1
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/controller/package-info.java
  29. 1
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/package-info.java
  30. 758
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/service/activity.java
  31. 1
      mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/service/package-info.java
  32. BIN
      mobileservice/src/main/resources/.DS_Store
  33. 19
      mobileservice/src/main/resources/application.properties
  34. BIN
      mobileservice/src/main/resources/static/assets/favicon.ico
  35. BIN
      mobileservice/src/main/resources/static/favicon.ico

BIN
.DS_Store

BIN
mobileservice/.DS_Store

BIN
mobileservice/src/.DS_Store

BIN
mobileservice/src/main/.DS_Store

BIN
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/1_approved.jpg

Before

Width: 1280  |  Height: 720  |  Size: 388 KiB

BIN
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/1_rejected.jpg

Before

Width: 1280  |  Height: 720  |  Size: 550 KiB

20
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/configuration/DataSourceConfig.java

@ -104,6 +104,16 @@ public class DataSourceConfig {
return dataSource;
}
//////////////////////////////(For Cattle Catch Master) ////////////////////////
@Bean(name = "mysqlHoardingsDataSource")
public DataSource mysqlHoardingsDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_penalty_hoardings");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
//////////////////////////////(For PGR Master) ////////////////////////
@Bean(name = "mysqlPGRMasterDataSource")
@ -182,6 +192,16 @@ public class DataSourceConfig {
return dataSource;
}
//////////////////////////////(For Schools) ////////////////////////
@Bean(name = "mysqlToiletsDataSource")
public DataSource mysqlToiletsDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_toilets");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
////////////////////////////// ORACLE ////////////////////////
@Bean(name = "oracleERPDataSource")

16
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccactivity/service/Activity.java

@ -799,7 +799,7 @@ public String assetFileUpload(String catId, MultipartFile file) {
// Step 1: Generate all dates within the specified month and year
String sqlQueryForTasks = "SELECT "
+ " `asset_list`.`id`,"
+ " `asset_list`.`id`, "
+ " `asset_list`.`category_id`, "
+ " `asset_list`.`image`, "
+ " `asset_list`.`latitude`, "
@ -817,14 +817,14 @@ public String assetFileUpload(String catId, MultipartFile file) {
+ "FROM "
+ " `activity_feedback` "
+ "JOIN "
+ " `asset_list` ON `asset_list`.`id` = `activity_feedback`.`asset_id` "
+ " `asset_list` "
+ " ON `asset_list`.`id` = `activity_feedback`.`asset_id` "
+ "WHERE "
+ " DATE_FORMAT(`activity_feedback`.`feedback_date`, '%d-%m-%Y') BETWEEN ? AND ? "
+ "AND "
+ " `asset_list`.`category_id` = ? "
+ "AND "
+ " `asset_list`.`streetid` = ? "
+ "AND (`asset_list`.`isactive`=1 AND `asset_list`.`isdelete`=0) "
+ " DATE(`activity_feedback`.`feedback_date`) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ " AND `asset_list`.`category_id` = ? "
+ " AND `asset_list`.`streetid` = ? "
+ " AND `asset_list`.`isactive` = 1 "
+ " AND `asset_list`.`isdelete` = 0 "
+ "GROUP BY "
+ " `asset_list`.`id`";

28
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccparks/controller/ParksController.java

@ -534,10 +534,10 @@ public class ParksController {
// ------------------------------------------Enumeration Report
// API-----------------------------------------------------
@GetMapping("/zoneCount")
@GetMapping("/zoneCount") // UserId added
public ResponseEntity<List<Map<String, Object>>> getZoneCount(@RequestParam("fromdate") String fromdate,
@RequestParam("todate") String todate, @RequestParam("enumeration_type") String enumeration_type,
@RequestParam("userId") String userId) throws Exception {
@RequestParam(value = "userId", required = false) String userId) throws Exception {
List<Map<String, Object>> zoneCountData = parksService.getZoneCount(fromdate, todate, enumeration_type, userId);
if (zoneCountData == null || zoneCountData.isEmpty()) {
@ -547,9 +547,9 @@ public class ParksController {
}
@GetMapping("/wardCount")
@GetMapping("/wardCount") // Zone added
public ResponseEntity<List<Map<String, Object>>> getwardCount(@RequestParam("zone") String zone,
@RequestParam("userId") String userId, @RequestParam("fromdate") String fromdate,
@RequestParam(value = "userId", required = false) String userId, @RequestParam("fromdate") String fromdate,
@RequestParam("todate") String todate, @RequestParam("enumeration_type") String enumeration_type)
throws Exception {
@ -561,13 +561,14 @@ public class ParksController {
}
@GetMapping("/activityCount")
@GetMapping("/activityCount") // userId and Zone added
public ResponseEntity<List<Map<String, Object>>> getActivityCount(@RequestParam("ward") String ward,
@RequestParam("fromdate") String fromdate, @RequestParam("todate") String todate,
@RequestParam("enumeration_type") String enumeration_type) throws Exception {
@RequestParam("enumeration_type") String enumeration_type, @RequestParam(value="userId", required = false) String userId,
@RequestParam("zone") String zone) throws Exception {
List<Map<String, Object>> activityByWard = parksService.getActivityCount(ward, fromdate, todate,
enumeration_type);
enumeration_type, zone, userId);
if (activityByWard == null || activityByWard.isEmpty()) {
throw new NoDataException("No Activity is performed ");
}
@ -575,14 +576,14 @@ public class ParksController {
}
@GetMapping("/activityDetails")
@GetMapping("/activityDetails") // userId and Zone added
public ResponseEntity<List<Map<String, Object>>> getActivityDetails(@RequestParam("ward") String ward,
@RequestParam("fromdate") String fromdate, @RequestParam("todate") String todate,
@RequestParam("enumeration_type") String enumeration_type,
@RequestParam("enumerationId") String enumerationId) throws Exception {
@RequestParam("enumeration_type") String enumeration_type,@RequestParam("enumerationId") String enumerationId,
@RequestParam(value="userId", required= false) String userId, @RequestParam("zone") String zone) throws Exception {
List<Map<String, Object>> activityDetailsByWard = parksService.getActivityDetails(ward, fromdate, todate,
enumeration_type, enumerationId);
enumeration_type, enumerationId, zone, userId);
if (activityDetailsByWard == null || activityDetailsByWard.isEmpty()) {
throw new NoDataException("no data ");
}
@ -590,10 +591,11 @@ public class ParksController {
}
@GetMapping("/getInspectionDetails")
@GetMapping("/getInspectionDetails") // zone, ward and userId added check it in last
public ResponseEntity<List<List<Map<String, Object>>>> getInspectionDetails(
@RequestParam("activityId") String activityId, @RequestParam("fromdate") String fromdate,
@RequestParam("todate") String todate, @RequestParam("enumerationId") String enumerationId)
@RequestParam("todate") String todate, @RequestParam("enumerationId") String enumerationId,
@RequestParam(value="userId", required = false) String userId )
throws Exception {
List<List<Map<String, Object>>> activityDetailsByWard = parksService.getInspectionDetails(activityId, fromdate,

133
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccparks/service/ParksService.java

@ -1408,64 +1408,117 @@ public class ParksService {
*/
public List<Map<String, Object>> getZoneCount(String fromdate, String todate, String enumeration_type, String userId )
throws Exception {
String sql = "SELECT zone,count(enumeration_Id) as count FROM enumeration_master"
+ " where enumeration_type=(?) and UserId = ? and DATE(cdate) BETWEEN STR_TO_DATE('" + fromdate + "', '%d-%m-%Y') "
+ "AND STR_TO_DATE('" + todate + "', '%d-%m-%Y') group by zone ";
StringBuilder sql = new StringBuilder("SELECT zone,count(enumeration_Id) as count FROM enumeration_master"
+ " where enumeration_type=(?) and DATE(cdate) BETWEEN STR_TO_DATE(? , '%d-%m-%Y') "
+ "AND STR_TO_DATE(? , '%d-%m-%Y') ");
List<Object> params = new ArrayList<>();
params.add(enumeration_type);
params.add(fromdate);
params.add(todate);
return jdbcParkseTemplate.queryForList(sql, new Object[] { enumeration_type, userId});
// if (userId != null) {
// sql.append(" AND UserId = ?");
// params.add(userId);
// }
}
/* 23-11-2024 Patch
public List<Map<String, Object>> getwardCount(String zone, String fromdate, String todate,
String enumeration_type) {
String sql = " SELECT ward,count(enumeration_Id) as count FROM enumeration_master "
+ "where zone=(?) and date(cdate) between STR_TO_DATE('" + fromdate + "', '%d-%m-%Y') "
+ "and STR_TO_DATE('" + todate + "', '%d-%m-%Y') And enumeration_type =(?) group by ward ";
return jdbcParkseTemplate.queryForList(sql, new Object[] { zone, enumeration_type });
sql.append(" GROUP BY zone");
return jdbcParkseTemplate.queryForList(sql.toString(), params.toArray());
}
*/
public List<Map<String, Object>> getwardCount(String zone, String fromdate, String todate, String enumeration_type,
String userId) {
String sql = " SELECT ward,count(enumeration_Id) as count FROM enumeration_master "
+ "where zone=(?) and UserId = ? and date(cdate) between STR_TO_DATE('" + fromdate + "', '%d-%m-%Y') "
+ "and STR_TO_DATE('" + todate + "', '%d-%m-%Y') And enumeration_type =(?) group by ward ";
return jdbcParkseTemplate.queryForList(sql, new Object[] { zone, enumeration_type, userId });
StringBuilder sql = new StringBuilder(" SELECT ward,count(enumeration_Id) as count FROM enumeration_master "
+ "where zone=(?) and date(cdate) between STR_TO_DATE(? , '%d-%m-%Y') "
+ "and STR_TO_DATE(? , '%d-%m-%Y') And enumeration_type =(?)");
List<Object> params = new ArrayList<>();
params.add(zone);
params.add(fromdate);
params.add(todate);
params.add(enumeration_type);
// if (userId != null) {
// sql.append(" AND UserId = ?");
// params.add(userId);
// }
sql.append(" group by ward");
return jdbcParkseTemplate.queryForList(sql.toString(), params.toArray());
}
public List<Map<String, Object>> getActivityCount(String ward, String fromdate, String todate,
String enumeration_type) {
/*String sql = "select act.feedback_enumeration_Id, act.ward,coalesce(em.park_name,em.location) AS location_Park,"
+ "count(act.feedback_enumeration_Id) as count from activity act left join enumeration_master em on "
+ "em.enumeration_Id = act.feedback_enumeration_Id where act.ward=? and act.feedback_enumeration_Type= ? "
+ "and date(act.cdate) between STR_TO_DATE('" + fromdate + "', '%d-%m-%Y') and "
+ "STR_TO_DATE('" + todate + "', '%d-%m-%Y') group by act.feedback_enumeration_Id, act.ward, location_Park";*/
String enumeration_type, String zone, String userId) {
StringBuilder sql = new StringBuilder("SELECT "
+ " em.enumeration_Id AS feedback_enumeration_Id, "
+ " em.ward, "
+ " COALESCE(em.park_name, em.location) AS location_Park, "
+ " COUNT(act.feedback_enumeration_Id) AS count "
+ "FROM "
+ " enumeration_master em "
+ "LEFT JOIN "
+ " activity act ON act.feedback_enumeration_Id = em.enumeration_Id "
+ " AND em.enumeration_Type = ?"
+ " AND DATE(act.cdate) BETWEEN STR_TO_DATE( '"+fromdate+"' , '%d-%m-%Y') "
+ " AND STR_TO_DATE('"+todate+"', '%d-%m-%Y') "
+ "WHERE "
+ " em.ward = ? "
+ " AND em.zone = ? "
+ " AND DATE(em.cdate) BETWEEN STR_TO_DATE('"+fromdate+"', '%d-%m-%Y') "
+ " AND STR_TO_DATE('"+todate+"' , '%d-%m-%Y') " );
String sql = "select em.enumeration_Id as feedback_enumeration_Id, em.ward, coalesce(em.park_name,em.location) AS location_Park, count(act.feedback_enumeration_Id) as count "
+ "from enumeration_master em "
+ "left join activity act on act.feedback_enumeration_Id = em.enumeration_Id "
+ "where act.ward = ? and act.feedback_enumeration_Type = ? "
+ "and date(act.cdate) between STR_TO_DATE('" + fromdate + "', '%d-%m-%Y') and STR_TO_DATE('" + todate + "', '%d-%m-%Y') "
+ "group by em.enumeration_Id, em.ward";
List<Object> params = new ArrayList<>();
params.add(enumeration_type);
params.add(ward);
params.add(zone);
return jdbcParkseTemplate.queryForList(sql, new Object[] { ward, enumeration_type});
sql.append(" GROUP BY em.enumeration_Id, em.ward, em.park_name, em.location");
// if (userId != null) {
// sql.append(" and act.user_Id = ?");
// params.add(userId);
// }
return jdbcParkseTemplate.queryForList(sql.toString(), params.toArray());
}
public List<Map<String, Object>> getActivityDetails(String ward, String fromdate, String todate,
String enumeration_type, String enumerationId) {
String sql = "SELECT act.feedback_enumeration_Id,act.activity_id, DATE_FORMAT(act.cdate, '%d-%m-%Y %l:%i %p') AS date, "
+ "act.feedback_latitude, act.feedback_longitude, et.enumerationName " + "FROM activity act "
String enumeration_type, String enumerationId, String zone, String userId ) {
StringBuilder sql = new StringBuilder( "SELECT act.feedback_enumeration_Id,act.activity_id, DATE_FORMAT(act.cdate, '%d-%m-%Y %l:%i %p') AS date, "
+ "act.feedback_latitude, act.feedback_longitude, et.enumerationName FROM activity act "
+ "LEFT JOIN enumerationtype et ON et.enumeration_type_id = act.feedback_enumeration_Type "
+ "WHERE act.ward = ? " + "AND act.feedback_enumeration_Type = ? "
+ "AND DATE(act.cdate) BETWEEN STR_TO_DATE('" + fromdate + "', '%d-%m-%Y') AND STR_TO_DATE('" + todate + "', '%d-%m-%Y') "
+ "and act.feedback_enumeration_Id = ?"
+ "GROUP BY act.feedback_enumeration_Id,act.activity_id, act.feedback_latitude, act.feedback_longitude, et.enumerationName";
+ "WHERE act.ward = ? and act.feedback_zone = ? AND act.feedback_enumeration_Type = ? "
+ "AND DATE(act.cdate) BETWEEN STR_TO_DATE(? , '%d-%m-%Y') AND STR_TO_DATE(? , '%d-%m-%Y') "
+ "and act.feedback_enumeration_Id = ?");
return jdbcParkseTemplate.queryForList(sql, new Object[] { ward, enumeration_type, enumerationId });
List<Object> params = new ArrayList<>();
params.add(ward);
params.add(zone);
params.add(enumeration_type);
params.add(fromdate);
params.add(todate);
params.add(enumerationId);
// if (userId != null) {
// sql.append(" and act.user_Id = ?");
// params.add(userId);
// }
sql.append(" GROUP BY act.feedback_enumeration_Id,act.activity_id, act.feedback_latitude, act.feedback_longitude, et.enumerationName");
return jdbcParkseTemplate.queryForList(sql.toString(),params.toArray());
}
@ -1503,7 +1556,7 @@ public class ParksService {
String sql = "select eqm.qa_name, fb.feedback_Name from feedback fb "
+ "left join enu_question_master eqm on eqm.qa_id = fb.feedback_qa_id "
+ "left join activity act on act.activity_id = fb.activity_id "
+ "where fb.activity_id =? and date(act.cdate) between STR_TO_DATE(' "+ fromdate + " ','%Y-%m-%d') and STR_TO_DATE('"+todate+"','%Y-%m-%d')";
+ "where fb.activity_id =? and date(act.cdate) between STR_TO_DATE(' "+ fromdate + " ','%d-%m-%Y') and STR_TO_DATE('"+todate+"','%d-%m-%Y')";
return jdbcParkseTemplate.queryForList(sql, new Object[] { activityId });
}
@ -1513,7 +1566,7 @@ public class ParksService {
String sql = "select *,coalesce(em.park_name,em.location) as parkName, " + "CONCAT('" + fileBaseUrl
+ "/gccofficialapp/files', eimg.photos_enu) AS imageUrl, em.latitude, em.longitude from enumertion_images eimg "
+ "left join enumeration_master em on em.enumeration_Id = eimg.enumerationImg_Id_master "
+ "where eimg.enumerationImg_Id_master = ? and date(eimg.cdate) between STR_TO_DATE(' "+ fromdate + " ','%Y-%m-%d') and STR_TO_DATE('"+todate+"','%Y-%m-%d')";
+ "where eimg.enumerationImg_Id_master = ? and date(eimg.cdate) between STR_TO_DATE(' "+ fromdate + " ','%d-%m-%Y') and STR_TO_DATE('"+todate+"','%d-%m-%Y')";
return jdbcParkseTemplate.queryForList(sql, new Object[] { enumerationId });
}

109
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccschools/controller/SchoolUserController.java

@ -38,6 +38,18 @@ public class SchoolUserController {
@Autowired
private SchoolUserActivity schoolUserActivity;
@GetMapping("/getSchoolList")
public ResponseEntity<List<Map<String, Object>>> getSchoolList(@RequestParam String ward, @RequestParam String category_type) {
List<Map<String, Object>> schoolList = schoolUserActivity.getSchoolList(ward,category_type);
if (schoolList.isEmpty()) {
// Return a "no data" message when the list is empty
return ResponseEntity.status(404).body(Collections.singletonList(Collections.singletonMap("message", "No data available")));
}
return ResponseEntity.ok(schoolList);
}
@PostMapping("/saveschool")
public ResponseEntity<String> saveSchool(
@RequestParam String latitude,
@ -175,6 +187,9 @@ public class SchoolUserController {
@RequestParam String typeoffacilitiesAns,
@RequestParam(required = false) MultipartFile feedPhoto,
@RequestParam(required = false) MultipartFile storageofdrinkingPhoto,
@RequestParam(required = false) MultipartFile roPhoto,
@RequestParam(required = false) int school_details_id,
@RequestParam String zone,
@RequestParam String division,
@ -191,7 +206,8 @@ public class SchoolUserController {
ROFacilitiesAvailableQa, ROFacilitiesAvailableAns,
ROGoodConditionQa, ROGoodConditionAns,DrinkingwaterfacilitiesQa,DrinkingwaterfacilitiesAns,
typeoffacilitiesQa,typeoffacilitiesAns,
feedPhoto, school_details_id, zone, division,latitude,longitude,user_id);
feedPhoto, storageofdrinkingPhoto, roPhoto,
school_details_id, zone, division,latitude,longitude,user_id);
return new ResponseEntity<>("Feedback saved successfully.", HttpStatus.OK);
} catch (Exception e) {
@ -360,6 +376,7 @@ public class SchoolUserController {
return new ResponseEntity<>("Failed to save feedback: " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PostMapping("/ITAssets")
public ResponseEntity<?> ITAssets(
@RequestParam int categoryId,
@ -375,6 +392,10 @@ public class SchoolUserController {
@RequestParam String UPSAvailableAns,
@RequestParam String UPSNotAvailableQa,
@RequestParam String UPSNotAvailableAns,
@RequestParam(required = false) String CCTVAvailableQa,
@RequestParam(required = false) String CCTVAvailableAns,
@RequestParam(required = false) String CCTVNotAvailableQa,
@RequestParam(required = false) String CCTVNotAvailableAns,
@RequestParam String NetworkAvailableQa,
@RequestParam String NetworkAvailableAns,
@RequestParam String projectorgoodconditionQa,
@ -396,6 +417,7 @@ public class SchoolUserController {
SystemAvailableQa, SystemAvailableAns, SystemNotAvailableQa, SystemNotAvailableAns,
PrinterAvailableQa, PrinterAvailableAns, PrinterNotAvailableQa, PrinterNotAvailableAns,
UPSAvailableQa, UPSAvailableAns, UPSNotAvailableQa, UPSNotAvailableAns,
CCTVAvailableQa, CCTVAvailableAns, CCTVNotAvailableQa, CCTVNotAvailableAns,
NetworkAvailableQa, NetworkAvailableAns,
projectorgoodconditionQa, projectorgoodconditionAns,
smartboardgoodconditionQa, smartboardgoodconditionAns,
@ -908,11 +930,11 @@ public class SchoolUserController {
@RequestParam(required = false) int school_details_id,
@RequestParam String zone,
@RequestParam String division,
@RequestParam Double latitude,
@RequestParam double latitude,
@RequestParam double longitude,
@RequestParam String user_id,
@RequestParam (required = false) String question_id
) {
) {
try {
// Call the service method to save feedback
@ -931,4 +953,85 @@ public class SchoolUserController {
return new ResponseEntity<>("Failed to save feedback: " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PostMapping("/savePlayFields")
public ResponseEntity<?> PlayFields(
@RequestParam int categoryId,
@RequestParam String playfieldavailableQa,
@RequestParam String playfieldavailableAns,
@RequestParam String civilworkQa,
@RequestParam String civilworkAns,
@RequestParam String electricalworkQa,
@RequestParam String electricalworkAns,
@RequestParam String sportsmaterialkQa ,
@RequestParam String sportsmaterialAns,
@RequestParam(required = false) MultipartFile playfieldPhoto,
@RequestParam(required = false) MultipartFile civilworkPhoto,
@RequestParam(required = false) int school_details_id,
@RequestParam String zone,
@RequestParam String division,
@RequestParam double latitude,
@RequestParam double longitude,
@RequestParam String user_id,
@RequestParam (required = false) String question_id
) {
try {
// Call the service method to save feedback
schoolUserActivity.savePlayFields(
categoryId,
playfieldavailableQa, playfieldavailableAns,
civilworkQa, civilworkAns,
electricalworkQa, electricalworkAns,
sportsmaterialkQa, sportsmaterialAns,
playfieldPhoto, civilworkPhoto,
school_details_id, zone, division,latitude,longitude,user_id,question_id
);
return new ResponseEntity<>("Feedback saved successfully.", HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>("Failed to save feedback: " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
//Complaints
//saveComplaintReplay(String complaintId, String user_id, String replay, MultipartFile cPhoto);
//getComplaints(userId);
//getComplaintsReplay(comid);
@GetMapping("/getComplaints")
public ResponseEntity<List<Map<String, Object>>> Complaints(@RequestParam String user_id) {
List<Map<String, Object>> ComplaintsList = schoolUserActivity.getComplaints(user_id);
return ResponseEntity.ok(ComplaintsList);
}
@PostMapping("/saveComplaintReplay")
public ResponseEntity<?> complaintReplay(
@RequestParam String complaintId,
@RequestParam String replay,
@RequestParam(required = true) MultipartFile file,
@RequestParam String user_id
) {
try {
// Call the service method to save feedback
schoolUserActivity.saveComplaintReplay(
complaintId,user_id,replay,file
);
return new ResponseEntity<>("Complaint replay saved successfully.", HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>("Failed to save Complaint replay: " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping("/getComplaintsReplay")
public ResponseEntity<List<Map<String, Object>>> ComplaintsReplay(@RequestParam String comid) {
List<Map<String, Object>> ComplaintReplayList = schoolUserActivity.getComplaintsReplay(comid);
return ResponseEntity.ok(ComplaintReplayList);
}
}

243
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/gccschools/service/SchoolUserActivity.java

@ -69,6 +69,14 @@ public class SchoolUserActivity {
return result.toString();
}
public static String generateRandomStringForFile(int String_Lenth) {
StringBuilder result = new StringBuilder(String_Lenth);
for (int i = 0; i < STRING_LENGTH; i++) {
result.append(CHARACTERS.charAt(RANDOM.nextInt(CHARACTERS.length())));
}
return result.toString();
}
private byte[] compressImage(BufferedImage image, float quality) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(byteArrayOutputStream);
@ -111,12 +119,13 @@ public class SchoolUserActivity {
// Datetime string
String datetimetxt = DateTimeUtil.getCurrentDateTime();
// File name
String fileName = name+ "_" +id + "_" + datetimetxt + "_" + file.getOriginalFilename();
System.out.println(file.getOriginalFilename());
String fileName = name+ "_" +id + "_" + datetimetxt + "_" + generateRandomStringForFile(10) + "_" + file.getOriginalFilename();
fileName = fileName.replaceAll("\\s+", ""); // Remove space on filename
String filePath = uploadDirectory + "/" + fileName;
String filepath_txt = "/"+serviceFolderName + year +"/"+month+"/"+fileName;
String filepath_txt = "/"+serviceFolderName + year + "/" + month + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
@ -140,6 +149,11 @@ public class SchoolUserActivity {
}
}
public List<Map<String, Object>> getSchoolList(String ward, String category_type) {
String sql = "SELECT * FROM school_list WHERE `division` = ? AND `category_type`= ? AND `gcc_app_updated`=0";
return jdbcSchoolsTemplate.queryForList(sql,ward,category_type);
}
public void saveSchool(String latitude, String longitude, MultipartFile photo, Integer schoolType, String schoolName, String earmark, String zone, String division, String userId) {
// Save or retrieve the school type ID based on schoolType
//Integer schoolTypeId = saveSchoolType(schoolType);
@ -147,9 +161,22 @@ public class SchoolUserActivity {
throw new IllegalArgumentException("Invalid school type ID: " + schoolType);
}
// First, check if the school already exists based on the school name
String checkIfExistsSql = "SELECT id FROM school_details WHERE school_name = ?";
// Check if the school exists
List<Map<String, Object>> existingSchool = jdbcSchoolsTemplate.queryForList(checkIfExistsSql, schoolName);
// If the school exists, return the existing school ID
if (!existingSchool.isEmpty()) {
throw new IllegalArgumentException("School Name Alerdy Exits : " + existingSchool.get(0).get("id"));
}
// Save school details and retrieve the generated school_details_id
int schoolDetailsId = saveSchoolDetails(latitude, longitude, schoolType, schoolName, earmark, zone, division, userId);
updateSchoolInactive(schoolName,schoolDetailsId);
String photoUrl = null;
// Handle file upload if a photo is provided
@ -166,7 +193,16 @@ public class SchoolUserActivity {
}
}
private void updateSchoolInactive(String id, int schoolDetailsId) {
String sql = "UPDATE `school_list` SET `gcc_app_updated`=? WHERE `school_name`=?";
jdbcSchoolsTemplate.update(sql, schoolDetailsId, id);
}
private int saveSchoolDetails(String latitude, String longitude, Integer schoolTypeId, String schoolName, String earmark, String zone, String division, String userId) {
// SQL statement to insert school details
String sql = "INSERT INTO school_details (latitude, longitude, school_type, school_name, earmark, zone, division, user_id) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ? )";
@ -363,7 +399,10 @@ public class SchoolUserActivity {
String typeoffacilitiesQa,
String typeoffacilitiesAns,
MultipartFile feedPhoto, // feedPhoto and schoolDetailsId were missing in the method signature
MultipartFile feedPhoto, // feedPhoto
MultipartFile storageofdrinkingPhoto, // storageofdrinkingPhoto
MultipartFile roPhoto, // roPhoto
int school_details_id,
String zone,
String division ,
@ -372,6 +411,9 @@ public class SchoolUserActivity {
String user_id) {
String feedPhotoPath = null;
String storageofdrinkingPhotoPath = null;
String roPhotoPath = null;
String feedref = generateRandomString(); //generate feedback reference text
// Handle file upload if a file is provided
@ -379,7 +421,23 @@ public class SchoolUserActivity {
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
feedPhotoPath = fileUpload(id, sdid, feedPhoto); // Adjusted to use schoolDetailsId
//feedPhotoPath = assetFileUpload(categoryId, feedPhoto, school_details_id);
}
// Handle file upload if a file is provided
if (storageofdrinkingPhoto != null && !storageofdrinkingPhoto.isEmpty()) {
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
storageofdrinkingPhotoPath = fileUpload(id, sdid, storageofdrinkingPhoto); // Adjusted to use schoolDetailsId
}
// Handle file upload if a file is provided
if (roPhoto != null && !roPhoto.isEmpty()) {
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
roPhotoPath = fileUpload(id, sdid, roPhoto); // Adjusted to use schoolDetailsId
}
// Save feedback for each question and answer pair
@ -397,6 +455,18 @@ public class SchoolUserActivity {
String qid = "33";
saveCategoryPhoto(categoryId, feedPhotoPath, qid, feedref);
}
// If a photo was uploaded, save it in the category_photos table
if (storageofdrinkingPhotoPath != null) {
String qid = "5";
saveCategoryPhoto(categoryId, storageofdrinkingPhotoPath, qid, feedref);
}
// If a photo was uploaded, save it in the category_photos table
if (roPhotoPath != null) {
String qid = "7";
saveCategoryPhoto(categoryId, roPhotoPath, qid, feedref);
}
}
/////////////////////////////////////////////////
@ -469,7 +539,7 @@ public class SchoolUserActivity {
if (toiletfeedPhoto != null && !toiletfeedPhoto.isEmpty()) {
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
toiletPhotoPath = fileUpload(id, sdid, RoomsfeedPhoto); // Adjusted to use schoolDetailsId
toiletPhotoPath = fileUpload(id, sdid, toiletfeedPhoto); // Adjusted to use schoolDetailsId
//toiletPhotoPath = assetFileUpload(categoryId, toiletfeedPhoto, school_details_id);
}
@ -483,7 +553,7 @@ public class SchoolUserActivity {
if (PlaygroundfeedPhoto != null && !PlaygroundfeedPhoto.isEmpty()) {
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
playgroundPhotoPath = fileUpload(id, sdid, RoomsfeedPhoto); // Adjusted to use schoolDetailsId
playgroundPhotoPath = fileUpload(id, sdid, PlaygroundfeedPhoto); // Adjusted to use schoolDetailsId
//playgroundPhotoPath = assetFileUpload(categoryId, PlaygroundfeedPhoto, school_details_id);
}
@ -631,6 +701,10 @@ public class SchoolUserActivity {
String UPSAvailableAns,
String UPSNotAvailableQa,
String UPSNotAvailableAns,
String CCTVAvailableQa,
String CCTVAvailableAns,
String CCTVNotAvailableQa,
String CCTVNotAvailableAns,
String NetworkAvailableQa,
String NetworkAvailableAns,
String projectorgoodconditionQa,
@ -685,8 +759,8 @@ public class SchoolUserActivity {
int school_details_id,
String zone,
String division,
Double latitude ,
Double longitude,
double latitude ,
double longitude,
String user_id) { // Add latitude parameter
String feedref = generateRandomString(); //generate feedback reference text
@ -699,13 +773,52 @@ public class SchoolUserActivity {
private void saveFeedbackDetails(
int categoryId, String qid, String feedback,
int school_details_id, String zone, String division,
double latitude,Double longitude,String user_id,
double latitude,double longitude,String user_id,
String feedref) {
String sql = "INSERT INTO feedback (cat_question_id, feedback, school_details_id, "
+ "zone, division, latitude, longitude, user_id, qid, feedref) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// Execute SQL query to save feedback for the provided question
jdbcSchoolsTemplate.update(sql, categoryId, feedback, school_details_id, zone, division, latitude, longitude, user_id, qid, feedref);
isComplaintRequired(""+categoryId, qid, feedref, ""+school_details_id, user_id, feedback);
}
private Boolean isComplaintRequired(String categoryId, String qid, String feedRef, String school_details_id, String user_id,String feedback) {
String sqlQuery="SELECT `category_questions`,`positive_ans`,`input_type` FROM `category_question` WHERE `id`= ? AND `risecompliance`=1 AND `is_active`=1";
List<Map<String, Object>> result = jdbcSchoolsTemplate.queryForList(sqlQuery, qid);
if (result.isEmpty()) {
return false;
}
// Build response map
String complaint_txt ="";
Map<String, Object> firstRow = result.get(0);
complaint_txt = firstRow.get("category_questions").toString();
String positive_ans = firstRow.get("positive_ans").toString();
String input_type = firstRow.get("input_type").toString();
complaint_txt = complaint_txt + " : " + feedback;
if(input_type.equals("radio")) {
if(feedback != null && !feedback.trim().isEmpty() && !positive_ans.equals(feedback)) {
System.out.println("Radio:" + feedback + "Qid : " + qid);
createComplaint(categoryId, qid, feedRef, school_details_id, user_id, complaint_txt, feedback);
}
}
if(input_type.equals("input_count")) {
if(feedback != null && !feedback.trim().isEmpty() && !positive_ans.equals(feedback)) {
System.out.println("input_count:" + feedback + "Qid : " + qid);
createComplaint(categoryId, qid, feedRef, school_details_id, user_id, complaint_txt, feedback);
}
}
return true;
}
private void saveCategoryPhoto(int categoryId, String photoPath, String qid, String feedRef) {
@ -715,6 +828,43 @@ public class SchoolUserActivity {
// Execute SQL query to save the photo path related to the category
jdbcSchoolsTemplate.update(sql, photoPath, 1, 0, categoryId, qid, feedRef);
}
/// Complaints
private void createComplaint(String categoryId, String qid, String feedRef, String school_details_id, String user_id, String complaint_txt, String feedback) {
System.out.println("Complaint : " + complaint_txt);
String sql = "INSERT INTO `complaints`(`cid`, `qid`, `feedref`, `school_details_id`, `user_id`, `complaint_txt`, `feedback`) "
+ "VALUES (?,?,?,?,?,?,?)";
// Execute SQL query to save the photo path related to the category
jdbcSchoolsTemplate.update(sql, categoryId, qid, feedRef, school_details_id, user_id, complaint_txt,feedback);
}
public void saveComplaintReplay(String complaintId, String user_id, String replay, MultipartFile cPhoto) {
String filePhotoPath="";
// Handle file upload if a photo is provided
if (cPhoto != null && !cPhoto.isEmpty()) {
// Make sure to pass the correct type for the first argument
String id = String.valueOf(complaintId);
String sdid = String.valueOf(user_id);
filePhotoPath = fileUpload("reply_"+id, sdid, cPhoto); // Adjusted to use schoolDetailsId
}
String sql = "INSERT INTO `complaints_reply`(`comid`, `replay`, `file`, `cby`) "
+ "VALUES (?,?,?,?)";
// Execute SQL query to save the photo path related to the category
jdbcSchoolsTemplate.update(sql, complaintId, replay, filePhotoPath, user_id);
updateComplaintStatus(complaintId);
}
private void updateComplaintStatus(String complaintId) {
String sql = "UPDATE `complaints` SET `status`='close' WHERE id = ?";
// Execute SQL query to save the photo path related to the category
jdbcSchoolsTemplate.update(sql,complaintId );
}
////////////////////////////
public List<Map<String, Object>> getAllSubCategories() {
@ -897,13 +1047,13 @@ public class SchoolUserActivity {
+ "JOIN category cd ON fb.cat_question_id = cd.id "
+ "JOIN school_details sd ON fb.school_details_id = sd.id "
+ "LEFT JOIN school_photos sp ON sd.id = sp.school_details_id "
+ "LEFT JOIN category_photos cp ON fb.qid = cp.qid "
+ "LEFT JOIN category_photos cp ON fb.qid = cp.qid AND cp.feedref= ? "
+ "LEFT JOIN category_question cq ON fb.qid = cq.id "
+ "JOIN school_type st ON st.id = sd.school_type "
+ "WHERE fb.feedref = ? "
+ "GROUP BY fb.zone, fb.division, fb.id, sd.school_name, cd.category, sd.school_type, fb.feedback, fb.feedref";
List<Map<String, Object>> result = jdbcSchoolsTemplate.queryForList(sql,feedref);
List<Map<String, Object>> result = jdbcSchoolsTemplate.queryForList(sql,feedref,feedref);
if (result.isEmpty()) {
return Collections.emptyMap();
@ -1024,7 +1174,7 @@ public class SchoolUserActivity {
String sampleoffoodmaintainedAns, String cookingstaffwearingQa, String cookingstaffwearingAns,
String fooditemsmatchwiththestockQa, String fooditemsmatchwiththestockAns,
String fooditemsusedofgoodqualityQa, String fooditemsusedofgoodqualityAns, MultipartFile feedPhoto,
int school_details_id, String zone, String division, Double latitude, double longitude,
int school_details_id, String zone, String division, double latitude, double longitude,
String user_id, String question_id) {
String feedPhotoPath = null;
@ -1058,6 +1208,75 @@ public class SchoolUserActivity {
}
}
public void savePlayFields(int categoryId,
String playfieldavailableQa, String playfieldavailableAns,
String civilworkQa, String civilworkAns,
String electricalworkQa, String electricalworkAns,
String sportsmaterialkQa, String sportsmaterialAns,
MultipartFile playfieldPhoto,
MultipartFile civilworkPhoto,
int school_details_id, String zone, String division, double latitude, double longitude,
String user_id, String question_id) {
String playfieldPhotoPath = null;
String civilworkPhotoPath = null;
// Handle file upload if a photo is provided
if (playfieldPhoto != null && !playfieldPhoto.isEmpty()) {
// Make sure to pass the correct type for the first argument
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
playfieldPhotoPath = fileUpload(id, sdid, playfieldPhoto); // Adjusted to use schoolDetailsId
}
if (civilworkPhoto != null && !civilworkPhoto.isEmpty()) {
String id = String.valueOf(categoryId);
String sdid = String.valueOf(school_details_id);
civilworkPhotoPath = fileUpload(id, sdid, civilworkPhoto); // Adjusted to use schoolDetailsId
//playgroundPhotoPath = assetFileUpload(categoryId, PlaygroundfeedPhoto, school_details_id);
}
// Create a map for questions and answers
Map<String, String> questionsAndAnswers = new HashMap<>();
questionsAndAnswers.put(playfieldavailableQa, playfieldavailableAns);
questionsAndAnswers.put(civilworkQa, civilworkAns);
questionsAndAnswers.put(electricalworkQa, electricalworkAns);
questionsAndAnswers.put(sportsmaterialkQa, sportsmaterialAns);
String feedref = generateRandomString(); //generate feedback reference text
// Save feedback for each question and answer pair
questionsAndAnswers.forEach((question, answer) ->
saveFeedbackDetails(categoryId, question, answer, school_details_id, zone, division, latitude, longitude, user_id,feedref)
);
// If a photo was uploaded, save it in the category_photos table
if (playfieldPhotoPath != null) {
String qid="59";
saveCategoryPhoto(categoryId,playfieldPhotoPath,qid,feedref);
}
if (civilworkPhotoPath != null) {
String qid="60";
saveCategoryPhoto(categoryId,civilworkPhotoPath,qid,feedref);
}
}
// Complaints List
public List<Map<String, Object>> getComplaints(String userId) {
String sql = "SELECT `id`, `cid`, `qid`, `feedref`, `school_details_id`, `complaint_txt`, `cdate`, `status`, `user_id` FROM `complaints` WHERE `user_id`=?";
List<Map<String, Object>> result = jdbcSchoolsTemplate.queryForList(sql,userId);
return result;
}
public List<Map<String, Object>> getComplaintsReplay(String comid) {
String sql = "SELECT `id`, `comid`, `replay`, `file`, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', file) AS photos, "
+ "`cby`, `cdate`, `isactive` FROM `complaints_reply` WHERE `comid`=?";
List<Map<String, Object>> result = jdbcSchoolsTemplate.queryForList(sql,comid);
return result;
}
}

297
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/controller/APIHoardingsController.java

@ -0,0 +1,297 @@
package in.gov.chennaicorporation.mobileservice.hoardings.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.mobileservice.hoardings.services.HoardingsService;
@RequestMapping("/gccofficialapp/hoardings/api")
@RestController("apiHoardingsRest")
public class APIHoardingsController {
@Autowired
private HoardingsService hoardingsService;
@GetMapping("/licenseVerify")
public List<?> licenseVerify(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "license_no", required = true) String license_no,
@RequestParam(value = "latitude", required = true) String latitude,
@RequestParam(value = "longitude", required = true) String longitude,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.licenseVerify(license_no,latitude,longitude);
}
@PostMapping(value="/saveHoardings") // Enumeration
public List<?> saveHoardings(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "categoryId", required = false) String categoryId,
@RequestParam(value = "assetName", required = false) String assetName,
@RequestParam(value = "latitude", required = false) String latitude,
@RequestParam(value = "longitude", required = false) String longitude,
@RequestParam(value = "zone", required = false) String zone,
@RequestParam(value = "ward", required = false) String ward,
@RequestParam(value = "streeId", required = false) String streeId,
@RequestParam(value = "streetName", required = false) String streetName,
@RequestParam(value = "loginId", required = false) String loginId,
@RequestParam(value = "remarks", required = false) String remarks,
@RequestParam(value = "file", required = false) MultipartFile file,
@RequestParam(value = "hoarding_info_type", required = false) String hoarding_info_type,
@RequestParam(value = "lincenses_info", required = false) String lincenses_info,
@RequestParam(value = "lincenses_no", required = false) String lincenses_no,
@RequestParam(value = "validity_date", required = false) String validity_date,
@RequestParam(value = "case_no", required = false) String case_no,
@RequestParam(value = "ptax_no", required = false) String ptax_no,
@RequestParam(value = "ptax_name", required = false) String ptax_name,
@RequestParam(value = "ptax_mobile", required = false) String ptax_mobile,
@RequestParam(value = "agency_name", required = false) String agency_name,
@RequestParam(value = "agency_mobile", required = false) String agency_mobile,
@RequestParam(value = "fine_to", required = false) String fine_to
) {
return hoardingsService.saveHoardings(formData, categoryId, assetName, latitude, longitude, zone, ward, streeId,
streetName, loginId,remarks,file,
hoarding_info_type,
lincenses_info,
lincenses_no,
validity_date,
case_no,
ptax_no,
ptax_name,
ptax_mobile,
agency_name,
agency_mobile,
fine_to);
}
@PostMapping(value="/updateHoardingInfo") // Enumeration
public List<?> updateHoardingInfo(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "loginId", required = true) String loginId,
@RequestParam(value = "asset_id", required = true) String asset_id,
@RequestParam(value = "remarks", required = false) String remarks,
@RequestParam(value = "hoarding_info_type", required = false) String hoarding_info_type,
@RequestParam(value = "lincenses_info", required = false) String lincenses_info,
@RequestParam(value = "lincenses_no", required = false) String lincenses_no,
@RequestParam(value = "validity_date", required = false) String validity_date,
@RequestParam(value = "case_no", required = false) String case_no,
@RequestParam(value = "ptax_no", required = false) String ptax_no,
@RequestParam(value = "ptax_name", required = false) String ptax_name,
@RequestParam(value = "ptax_mobile", required = false) String ptax_mobile,
@RequestParam(value = "agency_name", required = false) String agency_name,
@RequestParam(value = "agency_mobile", required = false) String agency_mobile,
@RequestParam(value = "fine_to", required = false) String fine_to
) {
return hoardingsService.updateHoardingInfo(formData,
asset_id,
hoarding_info_type,
remarks,
lincenses_info,
lincenses_no,
validity_date,
case_no,
ptax_no,
ptax_name,
ptax_mobile,
agency_name,
agency_mobile,
fine_to,
loginId);
}
@GetMapping("/assetlist")
public List<?> assetlist(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.assetlist(formData,loginId);
}
@GetMapping("/assetlistbylogin")
public List<?> assetlistbylogin(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "loginId", required = true) String loginId) {
return hoardingsService.assetlistbylogin(formData,loginId);
}
@GetMapping("/assetlistbylatlong")
public List<?> assetlistbylatlong(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "latitude", required = true) String latitude,
@RequestParam(value = "longitude", required = true) String longitude,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.assetlistbylatlong(formData, latitude, longitude,loginId);
}
@GetMapping("/getChallanPOSData")
public List<?> getChallanPOSData(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "orderid", required = false) String orderid,
@RequestParam(value = "loginid", required = true) String loginid) {
return hoardingsService.getChallanPOSData(formData,orderid,loginid);
}
@GetMapping("/updateSerialNumber")
public List<?> updateSerialNumber(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "tid", required = true) String tid,
@RequestParam(value = "mid", required = true) String mid,
@RequestParam(value = "serialNumber", required = true) String serialNumber,
@RequestParam(value = "orderid", required = true) String orderid) {
return hoardingsService.updateSerialNumber(formData,tid, mid, serialNumber, orderid);
}
@PostMapping("/storeBankTransaction")
public List<?> storeBankTransaction(@RequestBody Map<String, Object> transactionData) {
return hoardingsService.storeBankTransaction(transactionData);
}
@PostMapping("/storeFailedBankTransaction")
public List<?> storeFailedBankTransaction(@RequestBody Map<String, Object> transactionData) {
return hoardingsService.storeFailedBankTransaction(transactionData);
}
@PostMapping(value="/updateHoardings") // Enumeration
public List<?> insertHoardingUpdatedData(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "asset_id", required = false) String asset_id,
@RequestParam(value = "update_type", required = false) String update_type,
@RequestParam(value = "removed_type", required = false) String removed_type,
@RequestParam(value = "file", required = false) MultipartFile file,
@RequestParam(value = "licenses_no_visible", required = false) String licenses_no_visible,
@RequestParam(value = "validity_date_visible", required = false) String validity_date_visible,
@RequestParam(value = "not_as_per_size", required = false) String not_as_per_size,
@RequestParam(value = "licenses_no", required = false) String licenses_no,
@RequestParam(value = "loginId", required = false) String loginId
) {
return hoardingsService.insertHoardingUpdatedData(formData,
asset_id,
update_type,
removed_type,
file,
licenses_no_visible,
validity_date_visible,
not_as_per_size,
licenses_no,
loginId);
}
@GetMapping("/unauterrizedassetlistbylogin")
public List<?> unAuterrizedAssetlist(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "loginId", required = true) String loginId) {
return hoardingsService.unAuterrizedAssetlist(formData,loginId);
}
@GetMapping("/unauterrizedassetlistbylatlong")
public List<?> assetlistbylatlong(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "latitude", required = true) String latitude,
@RequestParam(value = "longitude", required = true) String longitude,
@RequestParam(value = "assetid", required = false) String assetid,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.unauterrizedassetlistbylatlong(formData, latitude, longitude, assetid, loginId);
}
@PostMapping(value="/updateHoardingsAE") // Enumeration
public List<?> insertHoardingUpdatedDataAE(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "asset_id", required = false) String asset_id,
@RequestParam(value = "remarks", required = false) String remarks,
@RequestParam(value = "removed_type", required = false) String removed_type,
@RequestParam(value = "file", required = false) MultipartFile file,
//@RequestParam(value = "firfile", required = false) MultipartFile firfile,
//@RequestParam(value = "fir", required = false) String fir,
//@RequestParam(value = "fir_number", required = false) String fir_number,
//@RequestParam(value = "material_collected", required = false) String material_collected,
//@RequestParam(value = "materialfile", required = false) MultipartFile materialfile,
@RequestParam(value = "loginId", required = false) String loginId
) {
return hoardingsService.insertHoardingUpdatedDataAE(formData,
asset_id,
remarks,
removed_type,
file,
//firfile,
//fir,
//fir_number,
//material_collected,
//materialfile,
loginId);
}
@PostMapping(value="/updateMaterialInfo") // Enumeration
public List<?> updateMaterialInfo(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "id", required = true) String id,
@RequestParam(value = "asset_id", required = true) String asset_id,
@RequestParam(value = "material_collected", required = false) String material_collected,
@RequestParam(value = "material_remarks", required = false) String material_remarks,
@RequestParam(value = "materialfile", required = false) MultipartFile materialfile,
@RequestParam(value = "loginId", required = false) String loginId
) {
return hoardingsService.updateMaterialInfo(
id,
asset_id,
material_collected,
material_remarks,
materialfile);
}
@PostMapping(value="/updateFirInfo") // Enumeration
public List<?> updateFirInfo(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "id", required = true) String id,
@RequestParam(value = "asset_id", required = true) String asset_id,
@RequestParam(value = "firfile", required = false) MultipartFile firfile,
@RequestParam(value = "fir_number", required = false) String fir_number,
@RequestParam(value = "fir_remarks", required = false) String fir_remarks,
@RequestParam(value = "loginId", required = false) String loginId
) {
return hoardingsService.updateFirInfo(
id,
asset_id,
fir_number,
fir_remarks,
firfile);
}
@GetMapping("/unAuterrizedAssetlistAEPending")
public List<?> unAuterrizedAssetlistAEPending(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "pendingType", required = true) String pendingType,
@RequestParam(value = "loginId", required = true) String loginId) {
return hoardingsService.unAuterrizedAssetlistAEPending(formData, pendingType, loginId);
}
@GetMapping("/ReportTile")
public List<?> ReportTile(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.ReportTile(fromDate, toDate);
}
@GetMapping("/reportZoneList")
public List<?> reportZoneList(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.reportZoneList(fromDate, toDate);
}
@GetMapping("/reportWardList")
public List<?> reportZoneList(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "zone", required = true) String zone,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.reportWardList(zone, fromDate, toDate);
}
@GetMapping("/reportListBySelect")
public List<?> reportZoneList(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "ward", required = true) String ward,
@RequestParam(value = "hoarding_info_type", required = true) String hoarding_info_type,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "loginId", required = false) String loginId) {
return hoardingsService.reportListBySelect(ward, hoarding_info_type, fromDate, toDate);
}
}

1
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/controller/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.mobileservice.hoardings.controller;

1
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.mobileservice.hoardings;

1956
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/services/HoardingsService.java
File diff suppressed because it is too large
View File

1
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/hoardings/services/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.mobileservice.hoardings.services;

9
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/nulm/controller/APINULMOfficerController.java

@ -71,4 +71,13 @@ public class APINULMOfficerController {
return nulmOfficerActivity.getStaffAttendanceListByDate(reporterId,specificDate);
}
@GetMapping(value="/getAttendanceListByStaff")
public List<?> getAttendanceListByStaff(@RequestParam(value="Year") String year,
@RequestParam(value="Month") String month, @RequestParam(value="EmpId") int empId,
@RequestParam(value="AttendanceType") String attendanceType){
return nulmOfficerActivity.getAttendanceListByStaff(year, month, empId, attendanceType);
}
}

29
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/nulm/service/NULMOfficerActivity.java

@ -350,4 +350,33 @@ public class NULMOfficerActivity {
return Collections.singletonList(response);
}
public List<String> getAttendanceListByStaff(String year, String month, int empId, String attendanceType) {
String sqlQuery = null;
if(attendanceType.equals("P")) {
sqlQuery = "select DATE_FORMAT(indatetime, '%d-%m-%Y') as DATE from attendance where enrollment_id = '"+empId+"' "
+ "and year(indatetime) = '"+year+"' and monthname(indatetime) = '"+month+"' ";
} else if(attendanceType.equals("A")) {
sqlQuery = "select DATE_FORMAT(leavedatetime, '%d-%m-%Y') as DATE from attendance where enrollment_id = '"+empId+"' "
+ "and year(leavedatetime) = '"+year+"' and monthname(leavedatetime) = '"+month+"' ";
} else if(attendanceType.equals("O")) {
sqlQuery = "select DATE_FORMAT (oddatetime, '%d-%m-%Y') as DATE from attendance where enrollment_id = '"+empId+"' "
+ "and year(oddatetime) = '"+year+"' and monthname(oddatetime) = '"+month+"' ";
}
// Execute the query
List<String> result = jdbcNULMTemplate.queryForList( sqlQuery, String.class);
if(result.isEmpty())
return Collections.singletonList("No Data Found");
else
return result;
}
}

79
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/controller/APICattleCatchController.java

@ -44,10 +44,16 @@ public class APICattleCatchController {
@GetMapping("/step1list")
public List<?> step1list(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "orderid", required = false) String loginId) {
@RequestParam(value = "loginid", required = false) String loginId) {
return cattleCatchService.step1list(formData,loginId);
}
@GetMapping(value = "/getdepotlist")
public List<?> getdepotlist(@RequestParam(value = "latitude", required = false) String latitude,
@RequestParam(value = "longitude", required = false) String longitude) {
return cattleCatchService.getdepotlist(latitude, longitude);
}
@PostMapping(value="/step2") // Move Catched cattle to depot
public List<?> step2(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "cinfoid", required = false) String cinfoid,
@ -68,8 +74,8 @@ public class APICattleCatchController {
@GetMapping("/step2list")
public List<?> step2list(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "orderid", required = false) String orderid) {
return cattleCatchService.step2list(formData,orderid);
@RequestParam(value = "depotid", required = true) String depotid) {
return cattleCatchService.step2list(formData,depotid);
}
@PostMapping(value="/step3") // Generate Fine Chellan when Violator is Available
@ -83,14 +89,14 @@ public class APICattleCatchController {
@RequestParam(value = "streetName", required = false) String streetName,
@RequestParam(value = "loginId", required = false) String loginId,
@RequestParam(value = "remarks", required = false) String remarks,
//@RequestParam(value = "isviolatorAvailable", required = false) String isviolatorAvailable,
@RequestParam(value = "depotid", required = false) String depotid,
@RequestParam(value = "violatorName", required = false) String violatorName,
@RequestParam(value = "violatorPhone", required = false) String violatorPhone,
@RequestParam(value = "fineAmount", required = false) String fineAmount,
@RequestParam(value = "file", required = false) MultipartFile file
) {
return cattleCatchService.step3(formData, cinfoids, latitude, longitude, zone, ward, streeId,
streetName, loginId,remarks,violatorName,violatorPhone,fineAmount,file);
streetName, loginId,remarks,violatorName,violatorPhone,fineAmount,depotid,file);
}
@GetMapping("/getChallanPOSData")
@ -100,11 +106,25 @@ public class APICattleCatchController {
return cattleCatchService.getChallanPOSData(formData,orderid,loginid);
}
@GetMapping("/updateSerialNumber")
public List<?> updateSerialNumber(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "tid", required = true) String tid,
@RequestParam(value = "mid", required = true) String mid,
@RequestParam(value = "serialNumber", required = true) String serialNumber,
@RequestParam(value = "orderid", required = true) String orderid) {
return cattleCatchService.updateSerialNumber(formData,tid, mid, serialNumber, orderid);
}
@PostMapping("/storeBankTransaction")
public List<?> storeBankTransaction(@RequestBody Map<String, Object> transactionData) {
return cattleCatchService.storeBankTransaction(transactionData);
}
@PostMapping("/storeFailedBankTransaction")
public List<?> storeFailedBankTransaction(@RequestBody Map<String, Object> transactionData) {
return cattleCatchService.storeFailedBankTransaction(transactionData);
}
@GetMapping("/step3list")
public List<?> step3list(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "loginid", required = true) String loginid) {
@ -128,4 +148,53 @@ public class APICattleCatchController {
streetName, loginId,remarks,file);
}
@GetMapping("/depotReport")
public List<?> DepotReport(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "loginid", required = false) String loginid) {
return cattleCatchService.depotReport(formData,fromDate,toDate,loginid);
}
@GetMapping("/zoneReport")
public List<?> zoneReport(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "depotid", required = true) String depotid,
@RequestParam(value = "loginid", required = false) String loginid) {
return cattleCatchService.zoneReport(formData,fromDate,toDate,depotid,loginid);
}
@GetMapping("/wardReport")
public List<?> zoneReport(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "zone", required = true) String zone,
@RequestParam(value = "depotid", required = true) String depotid,
@RequestParam(value = "loginid", required = false) String loginid) {
return cattleCatchService.wardReport(formData,fromDate,toDate,zone,depotid,loginid);
}
@GetMapping("/inListReport")
public List<?> inListReport(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "zone", required = true) String zone,
@RequestParam(value = "ward", required = true) String ward,
@RequestParam(value = "depotid", required = true) String depotid,
@RequestParam(value = "loginid", required = false) String loginid) {
return cattleCatchService.inListReport(formData,fromDate,toDate,zone,ward,depotid,loginid);
}
@GetMapping("/outListReport")
public List<?> outListReport(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "fromDate", required = true) String fromDate,
@RequestParam(value = "toDate", required = true) String toDate,
@RequestParam(value = "zone", required = true) String zone,
@RequestParam(value = "ward", required = true) String ward,
@RequestParam(value = "depotid", required = true) String depotid,
@RequestParam(value = "loginid", required = false) String loginid) {
return cattleCatchService.outListReport(formData,fromDate,toDate,zone,ward,depotid,loginid);
}
}

14
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/controller/APIPenaltyControllerPOS.java

@ -64,11 +64,16 @@ public class APIPenaltyControllerPOS {
@RequestParam(value = "loginId", required = false) String loginId,
@RequestParam(value = "violatorName", required = false) String violatorName,
@RequestParam(value = "violatorPhone", required = false) String violatorPhone,
@RequestParam(value = "violatorCompany", required = false) String violatorCompany,
@RequestParam(value = "ton", required = false) String ton,
@RequestParam(value = "amount", required = false) String amount,
@RequestParam(value = "tid", required = false) String tid,
@RequestParam(value = "mid", required = false) String mid,
@RequestParam(value = "serialNumber", required = false) String serialNumber,
@RequestParam(value = "file", required = false) MultipartFile file
) {
return penaltyServicePOS.generateChallanPOS(formData, categoryId, latitude, longitude, zone, ward,loginId,violatorName,violatorPhone,ton,amount,file);
return penaltyServicePOS.generateChallanPOS(formData, categoryId, latitude, longitude, zone, ward,
loginId, violatorName, violatorPhone, violatorCompany, ton, amount, tid, mid, serialNumber, file);
}
@PostMapping("/storeBankTransaction")
@ -76,8 +81,13 @@ public class APIPenaltyControllerPOS {
return penaltyServicePOS.storeBankTransaction(transactionData);
}
@PostMapping("/storeFailedBankTransaction")
public List<?> storeFailedBankTransaction(@RequestBody Map<String, Object> transactionData) {
return penaltyServicePOS.storeFailedBankTransaction(transactionData);
}
@PostMapping(value="/storeOfflineTransaction")
public List<?> generateChallan(@RequestParam MultiValueMap<String, String> formData,
public List<?> generateOfflineChallan(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "transactionResponseStatus", required = false) String transactionResponseStatus,
@RequestParam(value = "bankName", required = false) String bankName,
@RequestParam(value = "transactionAmount", required = false) String transactionAmount,

791
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/service/CattleCatchService.java

@ -14,6 +14,7 @@ import java.sql.SQLException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -121,7 +122,7 @@ public class CattleCatchService {
return byteArrayOutputStream.toByteArray();
}
public String fileUpload(String name, String id, MultipartFile file) {
public String fileUpload(String name, String id, String folder, MultipartFile file) {
int lastInsertId = 0;
// Set the file path where you want to save it
@ -130,7 +131,7 @@ public class CattleCatchService {
var year =DateTimeUtil.getCurrentYear();
var month =DateTimeUtil.getCurrentMonth();
uploadDirectory = uploadDirectory + serviceFolderName + year +"/"+month+"/";
uploadDirectory = uploadDirectory + serviceFolderName + year +"/"+month+"/"+folder+"/";
try {
// Create directory if it doesn't exist
@ -147,7 +148,7 @@ public class CattleCatchService {
String filePath = uploadDirectory + "/" + fileName;
String filepath_txt = "/"+serviceFolderName + year +"/"+month+"/"+fileName;
String filepath_txt = "/"+serviceFolderName + year +"/"+month+"/"+folder+"/"+fileName;
// Create a new Path object
Path path = Paths.get(filePath);
@ -192,7 +193,7 @@ public class CattleCatchService {
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
String image = fileUpload("cc_step1",category_id,file);
String image = fileUpload("cc_step1_catch",category_id,"catch",file);
String sqlQuery = "INSERT INTO `cc_step1`(`category_id`, `image`, `latitude`, `longitude`, "
+ "`zone`, `ward`, `streetid`, `streetname`, `catch_by`,`remarks`) "
@ -233,7 +234,7 @@ public class CattleCatchService {
System.out.println("Cattle caught successfully! Insert ID: " + generatedId);
} else {
response.put("status", "error");
response.put("message", "Failed to insert a new Penalty (Chellan).");
response.put("message", "Failed to insert a new caught (Info).");
}
} catch (DataAccessException e) {
System.out.println("Data Access Exception:");
@ -264,22 +265,39 @@ public class CattleCatchService {
String sqlQuery = "SELECT *, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',`image`) as imageurl "
+ " From `cc_step1` WHERE (`isactive`=1 AND `isdelete`=0)";
+ " From `cc_step1` WHERE (`isactive`=1 AND `isdelete`=0 AND `checkin`=0)";
if(loginid!=null && !loginid.isEmpty() && !loginid.isBlank()) {
sqlQuery= sqlQuery +" AND `catch_by`='"+loginid+"'";
}
sqlQuery = sqlQuery + " LIMIT 1";
//sqlQuery = sqlQuery + " LIMIT 1";
//System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Challan Details");
response.put("message", "List for ChekIn");
response.put("data", result);
return result;
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> getdepotlist(String latitude, String longitude) {
String sqlQuery = "";
sqlQuery = "SELECT * " + "FROM depot_list " + "WHERE (isactive=1 AND isdelete=0) AND "
+ " ((6371008.8 * acos( ROUND(cos(radians(?)) * cos(radians(latitude)) * cos(radians(longitude) - radians(?)) + sin(radians(?)) * sin(radians(latitude)), 9) )) < 500)";
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,
new Object[] { latitude, longitude, latitude });
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Request Information");
response.put("Data", result);
return Collections.singletonList(response);
}
@Transactional
@ -300,7 +318,7 @@ public class CattleCatchService {
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
String image = fileUpload("cc_step2",cinfoid,file);
String image = fileUpload("cc_step2_in",cinfoid,"checkin",file);
String sqlQuery = "INSERT INTO `cc_step2`(`cinfoid`,`image`, `latitude`, `longitude`, "
+ "`zone`, `ward`, `streetid`, `streetname`, `in_by`,`remarks`,`depotid`) "
@ -340,6 +358,8 @@ public class CattleCatchService {
response.put("status", "success");
response.put("message", "Cattle successfully checked into the depot!");
System.out.println("Cattle successfully checked into the depot! Insert ID: " + generatedId);
updateStep1(cinfoid);
} else {
response.put("status", "error");
response.put("message", "Failed to checked into the depot");
@ -366,29 +386,87 @@ public class CattleCatchService {
return Collections.singletonList(response);
}
public String updateStep1(String cinfoid) {
String sqlQuery = "UPDATE `cc_step1` SET checkin = 1 WHERE id = ? LIMIT 1";
//System.out.println(sqlQuery);
jdbcPenaltyTemplate.update(sqlQuery, cinfoid);
return "success";
}
@Transactional
public List<Map<String, Object>> step2list(
MultiValueMap<String, String> formData,
String orderid) {
String sqlQuery = "SELECT *, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',`image`) as imageurl "
+ " From `cc_step2` WHERE (`isactive`=1 AND `isdelete`=0) AND `status`='in'";
if(orderid!=null && !orderid.isEmpty() && !orderid.isBlank()) {
sqlQuery= sqlQuery +" ";
String depotid) {
String sqlQuery = "SELECT s2.`id`, s2.`cinfoid`, s2.`depotid`, s2.`in_by`, "
+ "DATE_FORMAT(s2.`in_date`, '%d-%m-%Y %H:%i') AS in_date, "
+ "s2.`remarks` as in_remarks, s1.catch_date, s1.catch_by, "
+ "s1.latitude, s1.longitude, s1.zone, s1.ward, s1.streetid, s1.streetname, s1.remarks as catch_remarks,"
+ "DATEDIFF(CURDATE(), in_date) AS days_since_in_date, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',s2.`image`) as in_imageurl, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',s1.`image`) as catch_imageurl "
+ "From `cc_step1` s1,`cc_step2` s2 WHERE (s1.`isactive`=1 AND s1.`isdelete`=0) AND (s1.id=s2.cinfoid) "
+ "AND s2.`status`='in'";
if(depotid!=null && !depotid.isEmpty() && !depotid.isBlank()) {
sqlQuery= sqlQuery +" AND depotid=?";
}
System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,depotid);
/*
//sqlQuery = sqlQuery + " LIMIT 1";
System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery);
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,depotid);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Challan Details");
response.put("message", "CheckIn List");
response.put("data", result);
return result;
*/
// Initialize response list
List<Map<String, Object>> detailedResult = new ArrayList<>();
// Iterate through the depots and get additional details
for (Map<String, Object> cattle : result) {
// Extract days from the current cattle entry
Object noOfDayObject = cattle.get("days_since_in_date");
if (noOfDayObject == null) {
continue; // Skip if of days is missing
}
String noofdays = noOfDayObject.toString(); // Assuming noOfDayObject is your object containing the days
int days = Integer.parseInt(noofdays); // Convert String to integer
int amount = 5000;
int extraDays = 0;
int finalAmount;
if (days <= 2) {
finalAmount = amount; // No extra charge
} else {
extraDays = days - 2; // Calculate extra days
finalAmount = amount + (extraDays * 1000); // Add extra charges
}
System.out.println("Final Amount: " + finalAmount);
// Add counts to the current depot details
Map<String, Object> detailedDepot = new HashMap<>(cattle);
detailedDepot.put("fineAmount", finalAmount);
// Add detailed depot to the response list
detailedResult.add(detailedDepot);
}
// Prepare response
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "CheckIn List");
response.put("data", detailedResult);
return Collections.singletonList(response);
}
@Transactional
@ -403,10 +481,10 @@ public class CattleCatchService {
String streetName,
String loginId,
String remarks,
//String isviolatorAvailable,
String violatorName,
String violatorPhone,
String fineAmount,
String depotid,
MultipartFile file) {
Map<String, Object> response = new HashMap<>();
@ -419,8 +497,8 @@ public class CattleCatchService {
String sqlQuery = "INSERT INTO `cc_step3`(`cinfoids`, `image`, `latitude`, `longitude`, "
+ "`zone`, `ward`, `streetid`, `streetname`, `challan_by`,`remarks`, "
+ " `violator_name`, `violator_phone`,`fine_amount`,`orderid`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ " `violator_name`, `violator_phone`,`fine_amount`,`orderid`,`depotid`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
@ -443,6 +521,7 @@ public class CattleCatchService {
ps.setString(12, violatorPhone);
ps.setString(13, fineAmount);
ps.setString(14, orderid);
ps.setString(15, depotid);
return ps;
}
}, keyHolder);
@ -500,7 +579,7 @@ public class CattleCatchService {
//+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',`image`) as imageurl, "
+ "`latitude`, `longitude`, `zone`, `ward`, "
+ "`challan_by`, `violator_name`, `violator_phone`, "
+ "`fine_amount`,`orderid`,`status` From `cc_step3` WHERE (`isactive`=1 AND `isdelete`=0) AND `status`='unpaid'";
+ "`fine_amount`,`orderid`,`status` From `cc_step3` WHERE (`isactive`=1 AND `isdelete`=0) AND (`status` <> 'Transaction success' AND `status` <> 'out') ";
if(orderid!=null && !orderid.isEmpty() && !orderid.isBlank()) {
sqlQuery= sqlQuery +" AND `orderid`='"+orderid+"'";
@ -518,7 +597,22 @@ public class CattleCatchService {
response.put("message", "Challan Details");
response.put("data", result);
return result;
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> updateSerialNumber(
MultiValueMap<String, String> formData,
String tid,
String mid,
String serialNumber,
String orderid){
String sqlQuery = "UPDATE cc_step3 SET tid = ?, mid = ?, serial_number = ? WHERE orderid = ? LIMIT 1";
jdbcPenaltyTemplate.update(sqlQuery, tid, mid, serialNumber, orderid);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Serial Number updated successfully");
return Collections.singletonList(response);
}
@Transactional
@ -566,6 +660,189 @@ public class CattleCatchService {
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int affectedRows = jdbcPenaltyTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sqlQuery, new String[]{"id"});
ps.setString(1, mid);
ps.setString(2, tid);
ps.setString(3, txnId);
ps.setString(4, bankName);
ps.setString(5, batchNumber);
ps.setDouble(6, transactionAmount);
ps.setString(7, transactionTitle);
ps.setString(8, txnAID);
ps.setString(9, txnApprCode);
ps.setString(10, txnCardNo);
ps.setString(11, txnCardType);
ps.setString(12, txnDate);
ps.setString(13, txnInvoice);
ps.setString(14, txnMode);
ps.setString(15, txnRefNo);
ps.setString(16, txnTC);
ps.setString(17, txnTSI);
ps.setString(18, txnTVR);
ps.setString(19, txnTime);
return ps;
}
}, keyHolder);
if (affectedRows > 0) {
Number generatedId = keyHolder.getKey();
lastInsertId = (generatedId != null) ? generatedId.intValue() : 0;
// Fetch inserted data for response, joining `penalty_challan` and `bank_transactions`
/*
String sqlQuery_joined = "SELECT pc.category_id, CONCAT('" + fileBaseUrl + "/gccofficialapp/files', pc.image) as imageurl, "
+ "pc.latitude, pc.longitude, pc.zone, pc.ward, pc.challan_by, "
+ "pc.violator_name, pc.violator_phone, pc.fine_amount, pc.orderid, pc.status, "
+ "bt.mid, bt.tid, bt.txnId, bt.bankName, bt.batchNumber, bt.transactionAmount, bt.transactionTitle, "
+ "bt.txnCardNo, bt.txnDate, bt.txnInvoice, bt.txnMode, bt.txnRefNo "
+ "FROM cc_step3 pc "
+ "LEFT JOIN bank_transactions bt ON pc.orderid = bt.txnId "
+ "WHERE pc.isactive = 1 AND pc.isdelete = 0 AND bt.id = ? LIMIT 1";
*/
String sqlQuery_joined = "SELECT"
+ " pc.`id`, "
+ " pc.`cinfoids`, "
+ " pc.`challan_by`, "
+ " DATE_FORMAT(pc.`challan_date`, '%d-%m-%Y %H:%i') AS challan_date, "
+ " pc.`latitude`, "
+ " pc.`longitude`, "
+ " pc.`zone`, "
+ " pc.`ward`, "
+ " pc.`streetid`, "
+ " pc.`streetname`, "
+ " pc.`image`, "
+ " pc.`remarks`, "
+ " pc.`status`, "
+ " pc.`isactive`, "
+ " pc.`isdelete`, "
+ " pc.`violator_name`, "
+ " pc.`violator_phone`, "
+ " pc.`fine_amount`, "
+ " pc.`orderid`, "
+ " pc.`depotid`, "
+ " LENGTH(pc.cinfoids) - LENGTH(REPLACE(pc.cinfoids, ',', '')) + 1 AS cattlecount, "
+ " CONCAT('https://gccservices.in/gccofficialapp/files', pc.`image`) AS imageurl, "
+ " bt.mid, "
+ " bt.tid, "
+ " bt.txnId, "
+ " bt.bankName, "
+ " bt.batchNumber, "
+ " bt.transactionAmount, "
+ " bt.transactionTitle, "
+ " bt.txnCardNo, "
+ " bt.txnDate, "
+ " bt.txnInvoice, "
+ " bt.txnMode, "
+ " bt.txnRefNo "
+ "FROM "
+ " `cc_step3` pc "
+ "LEFT JOIN "
+ " `bank_transactions` bt ON pc.orderid = bt.txnId "
+ "WHERE "
+ " (pc.`isactive` = 1 AND pc.`isdelete` = 0) "
+ " AND (bt.id = ?)";
System.out.println(sqlQuery_joined);
// Execute the query
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_joined, lastInsertId);
response.put("status", 200);
response.put("message", "Transaction stored successfully!");
response.put("data", result);
updatePaymentStatus(txnId, transactionResponseStatus);
} else {
response.put("status", 201);
response.put("message", "Failed to store the transaction.");
response.put("data", "");
}
} catch (DataAccessException e) {
response.put("status", 500);
response.put("message", "Database error while storing transaction.");
response.put("error", e.getMessage());
e.printStackTrace(); // This will give you more detail in logs
}
} else {
response.put("status", 400);
response.put("message", "Transaction failed or invalid status.");
}
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> storeFailedBankTransaction(Map<String, Object> transactionData) {
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
// Extract data from the JSON object
String transactionResponseStatus = (String) transactionData.get("transactionResponseStatus");
// Check if the transaction was successful
if ("Transaction cancelled".equalsIgnoreCase(transactionResponseStatus)) {
String mid = (String) transactionData.get("mid");
String tid = (String) transactionData.get("tid");
String txnId = (String) transactionData.get("txnId");
// Fetch nested transaction response data
Map<String, Object> txnResponseData = (Map<String, Object>) transactionData.get("txnResponseData");
String bankName = (String) txnResponseData.get("bankName");
String batchNumber = (String) txnResponseData.get("batchNumber");
String transactionTitle = (String) txnResponseData.get("transactionTitle");
String txnAID = (String) txnResponseData.get("txnAID");
String txnApprCode = (String) txnResponseData.get("txnApprCode");
String txnCardNo = (String) txnResponseData.get("txnCardNo");
String txnCardType = (String) txnResponseData.get("txnCardType");
String txnDate = (String) txnResponseData.get("txnDate");
String txnInvoice = (String) txnResponseData.get("txnInvoice");
String txnMode = (String) txnResponseData.get("txnMode");
String txnRefNo = (String) txnResponseData.get("txnRefNo");
String txnTC = (String) txnResponseData.get("txnTC");
String txnTSI = (String) txnResponseData.get("txnTSI");
String txnTVR = (String) txnResponseData.get("txnTVR");
String txnTime = (String) txnResponseData.get("txnTime");
// Convert transaction amount properly
//Double transactionAmount = Double.valueOf((String) txnResponseData.get("transactionAmount"));
// Get the transactionAmount from txnResponseData
String transactionAmountStr = (String) txnResponseData.get("transactionAmount");
// Check if the transactionAmount is not null and not empty before converting
Double transactionAmountTemp = null;
if (transactionAmountStr != null && !transactionAmountStr.trim().isEmpty()) {
try {
// Convert the valid string to a Double
transactionAmountTemp = Double.valueOf(transactionAmountStr);
} catch (NumberFormatException e) {
// Handle the case where the string cannot be parsed to a Double // Log the error or throw a custom exception
System.out.println("Error: Unable to parse transactionAmount to Double. " + e.getMessage());
transactionAmountTemp = 0.0; // Set to a default value or handle as needed
}
} else {
// Handle the case where transactionAmount is empty or null
transactionAmountTemp = 0.0; // Default value or handle as needed
}
Double transactionAmount = transactionAmountTemp;
String sqlQuery = "INSERT INTO bank_failed_transactions (mid, tid, txnId, bankName, batchNumber, transactionAmount, "
+ "transactionTitle, txnAID, txnApprCode, txnCardNo, txnCardType, txnDate, txnInvoice, txnMode, txnRefNo, "
+ "txnTC, txnTSI, txnTVR, txnTime) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int affectedRows = jdbcPenaltyTemplate.update(new PreparedStatementCreator() {
@Override
@ -601,6 +878,7 @@ public class CattleCatchService {
updatePaymentStatus(txnId, transactionResponseStatus);
// Fetch inserted data for response, joining `penalty_challan` and `bank_transactions`
/*
String sqlQuery_joined = "SELECT pc.category_id, CONCAT('" + fileBaseUrl + "/gccofficialapp/files', pc.image) as imageurl, "
+ "pc.latitude, pc.longitude, pc.zone, pc.ward, pc.challan_by, "
+ "pc.violator_name, pc.violator_phone, pc.fine_amount, pc.orderid, pc.status, "
@ -609,10 +887,54 @@ public class CattleCatchService {
+ "FROM cc_step3 pc "
+ "LEFT JOIN bank_transactions bt ON pc.orderid = bt.txnId "
+ "WHERE pc.isactive = 1 AND pc.isdelete = 0 AND bt.id = ? LIMIT 1";
*/
String sqlQuery_joined = "SELECT"
+ " pc.`id`, "
+ " pc.`cinfoids`, "
+ " pc.`challan_by`, "
+ " DATE_FORMAT(pc.`challan_date`, '%d-%m-%Y %H:%i') AS challan_date, "
+ " pc.`latitude`, "
+ " pc.`longitude`, "
+ " pc.`zone`, "
+ " pc.`ward`, "
+ " pc.`streetid`, "
+ " pc.`streetname`, "
+ " pc.`image`, "
+ " pc.`remarks`, "
+ " pc.`status`, "
+ " pc.`isactive`, "
+ " pc.`isdelete`, "
+ " pc.`violator_name`, "
+ " pc.`violator_phone`, "
+ " pc.`fine_amount`, "
+ " pc.`orderid`, "
+ " pc.`depotid`, "
+ " LENGTH(pc.cinfoids) - LENGTH(REPLACE(pc.cinfoids, ',', '')) + 1 AS cattlecount, "
+ " CONCAT('https://gccservices.in/gccofficialapp/files', pc.`image`) AS imageurl, "
+ " bt.mid, "
+ " bt.tid, "
+ " bt.txnId, "
+ " bt.bankName, "
+ " bt.batchNumber, "
+ " bt.transactionAmount, "
+ " bt.transactionTitle, "
+ " bt.txnCardNo, "
+ " bt.txnDate, "
+ " bt.txnInvoice, "
+ " bt.txnMode, "
+ " bt.txnRefNo "
+ "FROM "
+ " `cc_step3` pc "
+ "LEFT JOIN "
+ " `bank_failed_transactions` bt ON pc.orderid = bt.txnId "
+ "WHERE "
+ " (pc.`isactive` = 1 AND pc.`isdelete` = 0) "
+ " AND (bt.id = ?)";
System.out.println(sqlQuery_joined);
// Execute the query
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_joined, lastInsertId);
response.put("status", 200);
response.put("message", "Transaction stored successfully!");
response.put("data", result);
@ -647,9 +969,14 @@ public class CattleCatchService {
MultiValueMap<String, String> formData,
String loginid) {
String sqlQuery = "SELECT *, "
String sqlQuery = "SELECT `id`, `cinfoids`, `challan_by`, "
+ "DATE_FORMAT(`challan_date`, '%d-%m-%Y %H:%i') AS challan_date, "
+ "`latitude`, `longitude`, `zone`, `ward`, `streetid`, `streetname`, "
+ "`image`, `remarks`, `status`, `isactive`, `isdelete`, `violator_name`, "
+ "`violator_phone`, `fine_amount`, `orderid`, `depotid`, "
+ "LENGTH(cinfoids) - LENGTH(REPLACE(cinfoids, ',', '')) + 1 AS cattlecount, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',`image`) as imageurl "
+ " From `cc_step3` WHERE (`isactive`=1 AND `isdelete`=0) AND `status`<>'unpaid'";
+ " From `cc_step3` WHERE (`isactive`=1 AND `isdelete`=0) AND (`status`<> 'unpaid' AND `status`<> 'out')";
if(loginid!=null && !loginid.isEmpty() && !loginid.isBlank()) {
sqlQuery= sqlQuery +" AND `challan_by`='"+loginid+"'";
@ -664,7 +991,7 @@ public class CattleCatchService {
response.put("message", "Challan Details");
response.put("data", result);
return result;
return Collections.singletonList(response);
}
@Transactional
@ -684,7 +1011,7 @@ public class CattleCatchService {
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
String image = fileUpload("cc_step2",cinfoid,file);
String image = fileUpload("cc_step4_out",cinfoid,"out",file);
String sqlQuery = "INSERT INTO `cc_step4`(`cinfoid`,`image`, `latitude`, `longitude`, "
+ "`zone`, `ward`, `streetid`, `streetname`, `out_by`,`remarks`) "
@ -708,21 +1035,19 @@ public class CattleCatchService {
ps.setString(8, streetName);
ps.setString(9, loginId);
ps.setString(10, remarks);
//ps.setString(11, isviolatorAvailable);
//ps.setString(12, violatorName);
//ps.setString(13, violatorPhone);
//ps.setString(14, ton);
return ps;
}
}, keyHolder);
if (affectedRows > 0) {
updateOutStatus(cinfoid,"out");
Number generatedId = keyHolder.getKey();
lastInsertId = (generatedId != null) ? generatedId.intValue() : 0;
response.put("insertId", lastInsertId);
response.put("status", "success");
response.put("message", "Cattle successfully checked out from the depot!");
System.out.println("Cattle successfully checked out from the depot! Insert ID: " + generatedId);
} else {
response.put("status", "error");
response.put("message", "Failed to checked out from the depot");
@ -749,6 +1074,391 @@ public class CattleCatchService {
return Collections.singletonList(response);
}
public String updateOutStatus(String id, String status) {
String sqlQuery = "UPDATE cc_step3 SET status = ? WHERE id = ? LIMIT 1";
jdbcPenaltyTemplate.update(sqlQuery, status, id);
return "success";
}
/*
@Transactional
public List<Map<String, Object>> DepotReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String loginid) {
String sqlQuery = "SELECT * FROM `depot_list` where `isactive`=1 AND `isdelete`=0";
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery);
//System.out.println(sqlQuery);
String depotid="1";
String sqlQuery_total = "SELECT count(id) as Total FROM `depot_list` where (`isactive`=1 AND `isdelete`=0) AND (`depotid`=?)";
List<Map<String, Object>> resultTotal = jdbcPenaltyTemplate.queryForList(sqlQuery_total,depotid);
String sqlQuery_paid = "SELECT count(s3.id) as TotalPaid FROM `cc_step3` s3,"
+ "where (`isactive`=1 AND `isdelete`=0) AND s3.`depotid`=?";
List<Map<String, Object>> resultPaid = jdbcPenaltyTemplate.queryForList(sqlQuery_total,depotid);
String sqlQuery_out = "SELECT count(s4.id) as TotalPaid FROM `cc_step4` s4,`cc_step3` s3,"
+ "where (`isactive`=1 AND `isdelete`=0) AND s3.`id`= s4.cinfoid AND s3.`depotid`=?";
List<Map<String, Object>> resultOut = jdbcPenaltyTemplate.queryForList(sqlQuery_total,depotid);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Zone List Details");
response.put("data", result);
return result;
}
*/
@Transactional
public List<Map<String, Object>> depotReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String loginid) {
// Fetch depot list
String sqlQuery = "SELECT * FROM `depot_list` WHERE (`isactive`=1 AND `isdelete`=0)";
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery);
// Initialize response list
List<Map<String, Object>> detailedResult = new ArrayList<>();
// Iterate through the depots and get additional details
for (Map<String, Object> depot : result) {
// Extract depotid from the current depot entry
Object depotIdObject = depot.get("id");
if (depotIdObject == null) {
continue; // Skip if depotid is missing
}
String depotid = depotIdObject.toString();
System.out.println("depotid : "+depotid);
// Fetch total count for this depot
String sqlQuery_total = "SELECT count(id) as Total FROM `cc_step2` " +
"WHERE (`isactive`=1 AND `isdelete`=0) "
+ "AND (`depotid`=? AND DATE(in_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y'))";
List<Map<String, Object>> resultTotal = jdbcPenaltyTemplate.queryForList(sqlQuery_total, depotid,fromDate,toDate);
/*
// Fetch total paid count for this depot
String sqlQuery_paid = "SELECT count(s3.id) as TotalPaid FROM `cc_step3` s3 " +
"WHERE (`isactive`=1 AND `isdelete`=0) AND (s3.`depotid`=? AND s3.`status`<>'unpaid')";
List<Map<String, Object>> resultPaid = jdbcPenaltyTemplate.queryForList(sqlQuery_paid, depotid);
*/
// Fetch total out count for this depot
String sqlQuery_out = "SELECT "
+ "IFNULL(SUM(DISTINCT temp.cinfoid_count), 0) AS TotalOut "
+ "FROM ( "
+ " SELECT "
+ " s2.cinfoid AS individual_cinfoid, "
+ " COUNT(*) AS cinfoid_count "
+ " FROM `cc_step2` s2 "
+ " JOIN `cc_step3` s3 ON FIND_IN_SET(s2.cinfoid, s3.cinfoids) "
+ " JOIN `cc_step4` s4 ON s3.`id` = s4.`cinfoid` "
+ " WHERE (s2.`isactive` = 1 AND s2.`isdelete` = 0) "
+ " AND (s2.`depotid` = ?) "
+ " AND DATE(s4.out_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ " "
+ ") temp";
List<Map<String, Object>> resultOut = jdbcPenaltyTemplate.queryForList(sqlQuery_out, depotid,fromDate,toDate);
/*
// Fetch total paid count for this depot
String sqlQuery_pending = "SELECT count(s2.id) as TotalPending FROM `cc_step2` s2 " +
"WHERE (s2.`isactive`=1 AND s2.`isdelete`=0) AND (s2.`depotid`=? AND s2.`status`='in')";
List<Map<String, Object>> resultPending = jdbcPenaltyTemplate.queryForList(sqlQuery_pending, depotid);
*/
// Add counts to the current depot details
Map<String, Object> detailedDepot = new HashMap<>(depot);
detailedDepot.put("Total", resultTotal.isEmpty() ? 0 : resultTotal.get(0).get("Total"));
//detailedDepot.put("TotalPaid", resultPaid.isEmpty() ? 0 : resultPaid.get(0).get("TotalPaid"));
detailedDepot.put("TotalOut", resultOut.isEmpty() ? 0 : resultOut.get(0).get("TotalOut"));
//detailedDepot.put("TotalPending", resultPending.isEmpty() ? 0 : resultPending.get(0).get("TotalPending"));
// Add detailed depot to the response list
detailedResult.add(detailedDepot);
}
// Prepare response
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Depot List Details");
response.put("data", detailedResult);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> zoneReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String depotid,
String loginid) {
// Fetch depot list
String sqlQuery = "SELECT s1.`zone`, dl.name FROM `cc_step1` s1,`cc_step2` s2,`depot_list` dl "
+ "WHERE (s2.`isactive`=1 AND s2.`isdelete`=0) "
+ "AND (s1.id=s2.cinfoid)"
+ "AND (s2.`depotid`=? and dl.id=s2.`depotid`) "
+ "AND DATE(s2.in_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "GROUP BY s1.`zone`, dl.name";
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,depotid, fromDate, toDate);
// Initialize response list
List<Map<String, Object>> detailedResult = new ArrayList<>();
// Iterate through the depots and get additional details
for (Map<String, Object> depot : result) {
// Extract depotid from the current depot entry
Object zoneObject = depot.get("zone");
if (zoneObject == null) {
continue; // Skip if depotid is missing
}
String zone = zoneObject.toString();
System.out.println("zone : "+zone);
System.out.println("depotid : "+depotid);
// Fetch total count for this depot
String sqlQuery_total = "SELECT count(s2.id) as Total FROM `cc_step1` s1,`cc_step2` s2 "
+ "WHERE (s1.`isactive`=1 AND s1.`isdelete`=0) AND (s2.`depotid`=?)"
+ "AND (s1.id=s2.cinfoid AND s1.zone=?) "
+ "AND DATE(s2.in_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y')";
List<Map<String, Object>> resultTotal = jdbcPenaltyTemplate.queryForList(sqlQuery_total, depotid, zone, fromDate, toDate);
/*
// Fetch total paid count for this depot
String sqlQuery_paid = "SELECT count(s3.id) as TotalPaid FROM `cc_step3` s3 " +
"WHERE (`isactive`=1 AND `isdelete`=0) AND (s3.`depotid`=? AND s3.`status`<>'unpaid') AND `zone`=?";
List<Map<String, Object>> resultPaid = jdbcPenaltyTemplate.queryForList(sqlQuery_paid, depotid,zone);
*/
// Fetch total out count for this depot
String sqlQuery_out = "SELECT IFNULL(SUM(unique_cattle_count), 0) AS cattlecount "
+ "FROM ( SELECT COUNT(DISTINCT s1.id) AS unique_cattle_count "
+ "FROM cc_step1 s1 JOIN cc_step3 s3 ON FIND_IN_SET(s1.id, s3.cinfoids) "
+ "JOIN cc_step4 s4 ON s3.id = s4.cinfoid "
+ "WHERE s1.isactive = 1 AND s1.isdelete = 0 AND s3.depotid = ? "
+ "AND s1.zone = ? AND DATE(s4.out_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') "
+ "AND STR_TO_DATE(?, '%d-%m-%Y') ) AS deduplicated_counts";
List<Map<String, Object>> resultOut = jdbcPenaltyTemplate.queryForList(sqlQuery_out, depotid,zone,fromDate,toDate);
System.out.println(sqlQuery_out);
/*
// Fetch total paid count for this depot
String sqlQuery_pending = "SELECT count(s2.id) as TotalPending FROM `cc_step2` s2 " +
"WHERE (s2.`isactive`=1 AND s2.`isdelete`=0) AND (s2.`depotid`=? AND s2.`status`='in')";
List<Map<String, Object>> resultPending = jdbcPenaltyTemplate.queryForList(sqlQuery_pending, depotid);
*/
// Add counts to the current depot details
Map<String, Object> detailedDepot = new HashMap<>(depot);
detailedDepot.put("Total", resultTotal.isEmpty() ? 0 : resultTotal.get(0).get("Total"));
//detailedDepot.put("TotalPaid", resultPaid.isEmpty() ? 0 : resultPaid.get(0).get("TotalPaid"));
detailedDepot.put("TotalOut", resultOut.isEmpty() ? 0 : resultOut.get(0).get("cattlecount"));
//detailedDepot.put("TotalPending", resultPending.isEmpty() ? 0 : resultPending.get(0).get("TotalPending"));
// Add detailed depot to the response list
detailedResult.add(detailedDepot);
}
// Prepare response
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Zone List Details");
response.put("data", detailedResult);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> wardReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String zone,
String depotid,
String loginid) {
// Fetch depot list
String sqlQuery = "SELECT s1.`zone`,s1.`ward`,dl.name FROM `cc_step1` s1,`cc_step2` s2,`depot_list` dl "
+ "WHERE (s2.`isactive`=1 AND s2.`isdelete`=0) "
+ "AND (s1.id=s2.cinfoid AND s1.zone=?)"
+ "AND (s2.`depotid`=? and dl.id=s2.`depotid`) "
+ "AND DATE(s2.in_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "GROUP BY s1.`zone`, s1.`ward`, dl.name";
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery, zone, depotid, fromDate, toDate);
// Initialize response list
List<Map<String, Object>> detailedResult = new ArrayList<>();
System.out.println("zone : "+zone);
System.out.println("depotid : "+depotid);
System.out.println("fromDate : "+fromDate);
System.out.println("toDate : "+toDate);
// Iterate through the depots and get additional details
for (Map<String, Object> depot : result) {
// Extract depotid from the current depot entry
Object wardObject = depot.get("ward");
if (wardObject == null) {
continue; // Skip if depotid is missing
}
String ward = wardObject.toString();
System.out.println("zone : "+zone);
System.out.println("depotid : "+depotid);
// Fetch total count for this depot
String sqlQuery_total = "SELECT count(s2.id) as Total FROM `cc_step1` s1,`cc_step2` s2 "
+ "WHERE (s1.`isactive`=1 AND s1.`isdelete`=0) AND (s2.`depotid`=?)"
+ "AND (s1.id=s2.cinfoid AND s1.zone=? AND s1.ward=?) "
+ "AND DATE(s2.in_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y')";
List<Map<String, Object>> resultTotal = jdbcPenaltyTemplate.queryForList(sqlQuery_total, depotid, zone, ward,fromDate, toDate);
/*
// Fetch total paid count for this depot
String sqlQuery_paid = "SELECT count(s3.id) as TotalPaid FROM `cc_step3` s3 " +
"WHERE (`isactive`=1 AND `isdelete`=0) AND (s3.`depotid`=? AND s3.`status`<>'unpaid') AND `zone`=?";
List<Map<String, Object>> resultPaid = jdbcPenaltyTemplate.queryForList(sqlQuery_paid, depotid,zone);
*/
// Fetch total out count for this depot
String sqlQuery_out = "SELECT IFNULL(SUM(unique_cattle_count), 0) AS cattlecount "
+ "FROM ( SELECT COUNT(DISTINCT s1.id) AS unique_cattle_count "
+ "FROM cc_step1 s1 JOIN cc_step3 s3 ON FIND_IN_SET(s1.id, s3.cinfoids) "
+ "JOIN cc_step4 s4 ON s3.id = s4.cinfoid "
+ "WHERE s1.isactive = 1 AND s1.isdelete = 0 AND s3.depotid = ? "
+ "AND s1.zone = ? AND s1.ward=? "
+ "AND DATE(s4.out_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') "
+ "AND STR_TO_DATE(?, '%d-%m-%Y') ) AS deduplicated_counts";
List<Map<String, Object>> resultOut = jdbcPenaltyTemplate.queryForList(sqlQuery_out, depotid,zone,ward,fromDate,toDate);
System.out.println(sqlQuery_out);
/*
// Fetch total paid count for this depot
String sqlQuery_pending = "SELECT count(s2.id) as TotalPending FROM `cc_step2` s2 " +
"WHERE (s2.`isactive`=1 AND s2.`isdelete`=0) AND (s2.`depotid`=? AND s2.`status`='in')";
List<Map<String, Object>> resultPending = jdbcPenaltyTemplate.queryForList(sqlQuery_pending, depotid);
*/
// Add counts to the current depot details
Map<String, Object> detailedDepot = new HashMap<>(depot);
detailedDepot.put("Total", resultTotal.isEmpty() ? 0 : resultTotal.get(0).get("Total"));
//detailedDepot.put("TotalPaid", resultPaid.isEmpty() ? 0 : resultPaid.get(0).get("TotalPaid"));
detailedDepot.put("TotalOut", resultOut.isEmpty() ? 0 : resultOut.get(0).get("cattlecount"));
//detailedDepot.put("TotalPending", resultPending.isEmpty() ? 0 : resultPending.get(0).get("TotalPending"));
// Add detailed depot to the response list
detailedResult.add(detailedDepot);
}
// Prepare response
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Ward List Details");
response.put("data", detailedResult);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> inListReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String zone,
String ward,
String depotid,
String loginid) {
String sqlQuery = "SELECT s1.`id`, s1.`category_id`, s1.`catch_by`, DATE_FORMAT(s1.`catch_date`, '%d-%m-%Y %H:%i') AS `catch_date`, s1.`latitude`, "
+ " s1.`longitude`, s1.`zone`, s1.`ward`, s1.`streetid`, s1.`streetname`, s1.`image`, s1.`remarks`, "
+ " DATE_FORMAT(s2.in_date, '%d-%m-%Y %H:%i') AS `in_date` , s2.in_by, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files',s1.`image`) as imageurl "
+ " From `cc_step1` s1, `cc_step2` s2 WHERE (s1.`isactive`=1 AND s1.`isdelete`=0) "
+ "AND (s1.id=s2.cinfoid AND s1.zone=? AND s1.ward=? AND s2.depotid=?) "
+ "AND DATE(s2.in_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y')";
//System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,zone,ward,depotid,fromDate,toDate);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Check IN List Details");
response.put("data", result);
return result;
}
@Transactional
public List<Map<String, Object>> outListReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String zone,
String ward,
String depotid,
String loginid) {
String sqlQuery_out = "SELECT DISTINCT "
+ " s1.`id`, "
+ " s1.`category_id`, "
+ " s1.`catch_by`, "
+ " DATE_FORMAT(s1.`catch_date`, '%d-%m-%Y %H:%i') AS catch_date, "
+ " s1.`latitude`, "
+ " s1.`longitude`, "
+ " s1.`zone`, "
+ " s1.`ward`, "
+ " s1.`streetid`, "
+ " s1.`streetname`, "
+ " s1.`remarks`, "
+ " DATE_FORMAT(s2.`in_date`, '%d-%m-%Y %H:%i') AS in_date, "
+ " s2.`in_by`, "
+ " DATE_FORMAT(s4.`out_date`, '%d-%m-%Y %H:%i') AS `out_date`, "
+ " s4.`out_by`, "
+ " DATEDIFF(s4.`out_date`, s2.`in_date`) AS days_since_in_date, "
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files', s1.`image`) AS inImageurl, "
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files', s4.`image`) AS outImageurl "
+ "FROM "
+ " cc_step1 s1 "
+ "JOIN "
+ " cc_step3 s3 ON FIND_IN_SET(s1.id, s3.cinfoids) "
+ "JOIN "
+ " cc_step4 s4 ON s3.id = s4.cinfoid "
+ "JOIN "
+ " cc_step2 s2 ON s1.id = s2.cinfoid "
+ "WHERE "
+ " s1.isactive = 1 "
+ " AND s1.isdelete = 0 "
+ " AND s1.zone = ? "
+ " AND s1.ward = ? "
+ " AND s3.depotid = ? "
+ " AND DATE(s4.out_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') "
+ " AND STR_TO_DATE(?, '%d-%m-%Y')";
//System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_out,zone,ward,depotid,fromDate,toDate);
Map<String, Object> response = new HashMap<>();
List<Map<String, Object>> detailedResult = new ArrayList<>();
for (Map<String, Object> cattle : result) {
Object noOfDayObject = cattle.get("days_since_in_date");
int days = (noOfDayObject != null) ? Integer.parseInt(noOfDayObject.toString()) : 0;
int baseAmount = 5000;
int extraChargePerDay = 1000;
int fineAmount = days <= 2 ? baseAmount : baseAmount + ((days - 2) * extraChargePerDay);
// Add fine amount to the current record
Map<String, Object> detailedCattle = new HashMap<>(cattle);
detailedCattle.put("fineAmount", fineAmount);
detailedResult.add(detailedCattle);
}
response.put("status", 200);
response.put("message", "Check Out List Details");
response.put("data", detailedResult);
return Collections.singletonList(response);
}
/*
@Transactional
public List<Map<String, Object>> zoneReport(
MultiValueMap<String, String> formData,
@ -756,8 +1466,10 @@ public class CattleCatchService {
String toDate,
String loginid) {
String sqlQuery = "SELECT zone, COUNT(*) AS zone_count FROM `cc_step1` WHERE "
+ "DATE(catch_date) BETWEEN ? AND ? GROUP BY zone ORDER BY zone";
String sqlQuery = "SELECT ward, COUNT(*) AS count "
+ "FROM `cc_step1` "
+ "WHERE catch_date BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "GROUP BY ward";
if(loginid!=null && !loginid.isEmpty() && !loginid.isBlank()) {
sqlQuery= sqlQuery +" AND `challan_by`='"+loginid+"'";
@ -767,7 +1479,7 @@ public class CattleCatchService {
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,fromDate,toDate);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Challan Details");
response.put("message", "Zone List Details");
response.put("data", result);
return result;
@ -782,7 +1494,7 @@ public class CattleCatchService {
String loginid) {
String sqlQuery = "SELECT ward, COUNT(*) AS zone_count FROM `cc_step1` WHERE "
+ "zone=? AND DATE(catch_date) BETWEEN ? AND ? GROUP BY ward ORDER BY ward";
+ "zone=? AND DATE(catch_date) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') GROUP BY ward ORDER BY ward";
if(loginid!=null && !loginid.isEmpty() && !loginid.isBlank()) {
sqlQuery= sqlQuery +" AND `challan_by`='"+loginid+"'";
@ -792,9 +1504,10 @@ public class CattleCatchService {
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery,zone,fromDate,toDate);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Challan Details");
response.put("message", "Ward List Details");
response.put("data", result);
return result;
}
*/
}

196
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/penalty/service/PenaltyServicePOS.java

@ -268,8 +268,12 @@ public class PenaltyServicePOS {
String loginId,
String violatorName,
String violatorPhone,
String violatorCompany,
String ton,
String amount,
String tid,
String mid,
String serialNumber,
MultipartFile file) {
Map<String, Object> response = new HashMap<>();
@ -279,11 +283,11 @@ public class PenaltyServicePOS {
String sqlQuery = "INSERT INTO `penalty_challan`(`category_id`, `image`, `latitude`, `longitude`, "
+ "`zone`, `ward`, `challan_by`, "
+ "`violator_name`, `violator_phone`, `ton`, `fine_amount`,`orderid`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
+ "`violator_name`, `violator_phone`, `ton`, `fine_amount`,`orderid`,`violator_company`,"
+ "`tid`, `mid`, `serial_number`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int affectedRows = jdbcPenaltyTemplate.update(new PreparedStatementCreator() {
@Override
@ -301,6 +305,10 @@ public class PenaltyServicePOS {
ps.setString(10, ton);
ps.setString(11, amount);
ps.setString(12, orderid);
ps.setString(13, violatorCompany);
ps.setString(14, tid);
ps.setString(15, mid);
ps.setString(16, serialNumber);
return ps;
}
}, keyHolder);
@ -310,8 +318,8 @@ public class PenaltyServicePOS {
lastInsertId = (generatedId != null) ? generatedId.intValue() : 0;
//CONCAT('"+fileBaseUrl+"/gccofficialapp/files', cp.photo_url) AS photos,
String sqlQuery_txt = "SELECT `category_id`,CONCAT('"+fileBaseUrl+"/gccofficialapp/files',`image`) as imageurl, `latitude`, `longitude`, `zone`, `ward`, "
+ "`challan_by`, `violator_name`, `violator_phone`, `ton`, "
+ "`fine_amount`,`orderid` From `penalty_challan` WHERE id='"+lastInsertId+"' LIMIT 1";
+ "`challan_by`, `violator_name`, `violator_phone`, `violator_company`, `ton`, "
+ "`fine_amount`,`orderid`,`tid`,`mid`,`serial_number` From `penalty_challan` WHERE id='"+lastInsertId+"' LIMIT 1";
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_txt);
//response.put("insertid", lastInsertId);
@ -320,6 +328,8 @@ public class PenaltyServicePOS {
//response.put("orderid", orderid);
response.put("data", result);
updateZoneWard(lastInsertId,loginId); // Update Zone and ward details
System.out.println("A new Penalty (Chellan) was generated successfully! Insert ID: " + generatedId);
} else {
response.put("status", 201);
@ -347,6 +357,37 @@ public class PenaltyServicePOS {
return Collections.singletonList(response);
}
public String updateZoneWard(int id, String loginid) {
// Select query to fetch data from the user_zone table
String sqluserLocation = "SELECT `SNO`, `ID`, `USER_NAME`, `FIRST_NAME`, `LOC_FLAG`, `LOC`, `ACTUAL_LOC`, `ZONE_HQ` "
+ "FROM `user_zone` WHERE `ID`=?";
// Fetch the result from the query (assuming only one row is returned)
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqluserLocation, loginid);
if (result.isEmpty()) {
System.out.println( "Challan User Loaction update: Error: User not found.");
// If no result is found, return an error message
return "Error: User not found.";
}
// Extract values from the result map (assuming the first record)
Map<String, Object> userZoneData = result.get(0);
String locFlag = (String) userZoneData.get("LOC_FLAG");
String loc = (String) userZoneData.get("LOC");
String actualLoc = (String) userZoneData.get("ACTUAL_LOC");
String zoneHq = (String) userZoneData.get("ZONE_HQ");
// Update query to update the penalty_challan table using the fetched values
String sqlQuery = "UPDATE penalty_challan SET `LOC_FLAG` = ?, `LOC` = ?, `ACTUAL_LOC` = ?, `ZONE_HQ` = ? WHERE id = ? LIMIT 1";
// Execute the update query using the values fetched from user_zone table
jdbcPenaltyTemplate.update(sqlQuery, locFlag, loc, actualLoc, zoneHq, id);
System.out.println( "Challan User Loaction Updated (id, loginid): " + id +" , " + loginid);
return "success"; // Return success after the update
}
@Transactional
public List<Map<String, Object>> getChallanPOSData(
MultiValueMap<String, String> formData,
@ -497,22 +538,141 @@ public class PenaltyServicePOS {
System.out.println(sqlQuery_joined);
// Execute the query
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_joined, lastInsertId);
/*
// Fetch inserted data for response
String sqlQuery_challan = "SELECT `category_id`,CONCAT('"+fileBaseUrl+"/gccofficialapp/files',`image`) as imageurl, `latitude`, `longitude`, `zone`, `ward`, "
+ "`challan_by`, `violator_name`, `violator_phone`, `ton`, "
+ "`fine_amount`, `orderid`, `status` From `penalty_challan` WHERE (`isactive`=1 AND `isdelete`=0) "
+ "AND `orderid`='"+txnId+"' LIMIT 1";
response.put("status", 200);
response.put("message", "Transaction stored successfully!");
response.put("data", result);
} else {
response.put("status", 201);
response.put("message", "Failed to store the transaction.");
response.put("data", "");
}
} catch (DataAccessException e) {
response.put("status", 500);
response.put("message", "Database error while storing transaction.");
response.put("error", e.getMessage());
e.printStackTrace(); // This will give you more detail in logs
}
} else {
response.put("status", 400);
response.put("message", "Transaction failed or invalid status.");
}
return Collections.singletonList(response);
}
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_challan, lastInsertId);
@Transactional
public List<Map<String, Object>> storeFailedBankTransaction(Map<String, Object> transactionData) {
// Fetch inserted data for response
String sqlQuery_txt = "SELECT mid, tid, txnId, bankName, batchNumber, transactionAmount, "
+ "transactionTitle, txnCardNo, txnDate, txnInvoice, txnMode, txnRefNo "
+ "FROM bank_transactions WHERE id = ? LIMIT 1";
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_txt, lastInsertId);
*/
// Extract data from the JSON object
String transactionResponseStatus = (String) transactionData.get("transactionResponseStatus");
// Check if the transaction was successful
if ("Transaction cancelled".equalsIgnoreCase(transactionResponseStatus)) {
String mid = (String) transactionData.get("mid");
String tid = (String) transactionData.get("tid");
String txnId = (String) transactionData.get("txnId");
// Fetch nested transaction response data
Map<String, Object> txnResponseData = (Map<String, Object>) transactionData.get("txnResponseData");
String bankName = (String) txnResponseData.get("bankName");
String batchNumber = (String) txnResponseData.get("batchNumber");
String transactionTitle = (String) txnResponseData.get("transactionTitle");
String txnAID = (String) txnResponseData.get("txnAID");
String txnApprCode = (String) txnResponseData.get("txnApprCode");
String txnCardNo = (String) txnResponseData.get("txnCardNo");
String txnCardType = (String) txnResponseData.get("txnCardType");
String txnDate = (String) txnResponseData.get("txnDate");
String txnInvoice = (String) txnResponseData.get("txnInvoice");
String txnMode = (String) txnResponseData.get("txnMode");
String txnRefNo = (String) txnResponseData.get("txnRefNo");
String txnTC = (String) txnResponseData.get("txnTC");
String txnTSI = (String) txnResponseData.get("txnTSI");
String txnTVR = (String) txnResponseData.get("txnTVR");
String txnTime = (String) txnResponseData.get("txnTime");
// Convert transaction amount properly
//Double transactionAmount = Double.valueOf((String) txnResponseData.get("transactionAmount"));
// Get the transactionAmount from txnResponseData
String transactionAmountStr = (String) txnResponseData.get("transactionAmount");
// Check if the transactionAmount is not null and not empty before converting
Double transactionAmountTemp = null;
if (transactionAmountStr != null && !transactionAmountStr.trim().isEmpty()) {
try {
// Convert the valid string to a Double
transactionAmountTemp = Double.valueOf(transactionAmountStr);
} catch (NumberFormatException e) {
// Handle the case where the string cannot be parsed to a Double // Log the error or throw a custom exception
System.out.println("Error: Unable to parse transactionAmount to Double. " + e.getMessage());
transactionAmountTemp = 0.0; // Set to a default value or handle as needed
}
} else {
// Handle the case where transactionAmount is empty or null
transactionAmountTemp = 0.0; // Default value or handle as needed
}
Double transactionAmount = transactionAmountTemp;
String sqlQuery = "INSERT INTO bank_failed_transactions (mid, tid, txnId, bankName, batchNumber, transactionAmount, "
+ "transactionTitle, txnAID, txnApprCode, txnCardNo, txnCardType, txnDate, txnInvoice, txnMode, txnRefNo, "
+ "txnTC, txnTSI, txnTVR, txnTime) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int affectedRows = jdbcPenaltyTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sqlQuery, new String[]{"id"});
ps.setString(1, mid);
ps.setString(2, tid);
ps.setString(3, txnId);
ps.setString(4, bankName);
ps.setString(5, batchNumber);
ps.setDouble(6, transactionAmount);
ps.setString(7, transactionTitle);
ps.setString(8, txnAID);
ps.setString(9, txnApprCode);
ps.setString(10, txnCardNo);
ps.setString(11, txnCardType);
ps.setString(12, txnDate);
ps.setString(13, txnInvoice);
ps.setString(14, txnMode);
ps.setString(15, txnRefNo);
ps.setString(16, txnTC);
ps.setString(17, txnTSI);
ps.setString(18, txnTVR);
ps.setString(19, txnTime);
return ps;
}
}, keyHolder);
if (affectedRows > 0) {
Number generatedId = keyHolder.getKey();
lastInsertId = (generatedId != null) ? generatedId.intValue() : 0;
updatePaymentStatus(txnId, transactionResponseStatus);
// Fetch inserted data for response, joining `penalty_challan` and `bank_transactions`
String sqlQuery_joined = "SELECT pc.category_id, CONCAT('" + fileBaseUrl + "/gccofficialapp/files', pc.image) as imageurl, "
+ "pc.latitude, pc.longitude, pc.zone, pc.ward, pc.challan_by, "
+ "pc.violator_name, pc.violator_phone, pc.ton, pc.fine_amount, pc.orderid, pc.status, "
+ "bt.mid, bt.tid, bt.txnId, bt.bankName, bt.batchNumber, bt.transactionAmount, bt.transactionTitle, "
+ "bt.txnCardNo, bt.txnDate, bt.txnInvoice, bt.txnMode, bt.txnRefNo "
+ "FROM penalty_challan pc "
+ "LEFT JOIN bank_transactions bt ON pc.orderid = bt.txnId "
+ "WHERE pc.isactive = 1 AND pc.isdelete = 0 AND bt.txnId = ? LIMIT 1";
System.out.println(sqlQuery_joined);
// Execute the query
List<Map<String, Object>> result = jdbcPenaltyTemplate.queryForList(sqlQuery_joined, txnId);
response.put("status", 200);
response.put("message", "Transaction stored successfully!");
response.put("data", result);

6
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/service/OfficialAPIService.java

@ -386,8 +386,10 @@ public class OfficialAPIService {
SqlQuery="SELECT *,CONCAT('https://gccservices.in/gccofficialapp/files/app_icon/menu/', icon_url) "
+ "AS iconUrl FROM `modules` WHERE `ISACTIVE`=1 AND `id` IN ("+menus+") ";
if(departmentId!=null && !departmentId.isEmpty() && !departmentId.isBlank()) {
SqlQuery=SqlQuery+" AND `departmentId_id`='"+departmentId+"'";
SqlQuery=SqlQuery+" AND `departmentId_id`='"+departmentId+"' ";
}
SqlQuery = SqlQuery+" ORDER BY `orderby`, `name` ASC";
List<Map<String, Object>> result = jdbcActivityTemplate.queryForList(SqlQuery);
return result;
}
@ -424,7 +426,7 @@ public class OfficialAPIService {
}
SqlQuery="SELECT *,CONCAT('https://gccservices.in/gccofficialapp/files/app_icon/menu/', icon_url) "
+ "AS iconUrl FROM `menuitem` WHERE `ISACTIVE`=1 AND `module_id`=? AND `id` IN ("+menuitem+")";
+ "AS iconUrl FROM `menuitem` WHERE `ISACTIVE`=1 AND `module_id`=? AND `id` IN ("+menuitem+") ORDER BY `orderby`, `name` ASC";
System.out.println(SqlQuery);
List<Map<String, Object>> result = jdbcActivityTemplate.queryForList(SqlQuery,menuId);

18
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/swmbwg/controller/APIController.java

@ -50,12 +50,26 @@ public class APIController {
@RequestParam(value="serviceprovider", required = false) String serviceprovider,
@RequestParam(value="serviceproviderid", required = false) String serviceproviderid,
@RequestParam(value="loginId", required = false) String cby,
@RequestParam(value = "image", required = false) MultipartFile filedata
@RequestParam(value = "image", required = false) MultipartFile filedata,
@RequestParam(value = "file", required = false) MultipartFile filedata2
){
return activity.saveRequest(latitude, longitude,
zone, ward, streetid, streetname, location, classid,
typeid, qtyofwaste, onsiteprocessing, serviceprovider,
serviceproviderid, cby, filedata);
serviceproviderid, cby, filedata, filedata2);
}
@GetMapping(value="/getServiceProviderPendingList")
public List<?> getServiceProviderPendingList(@RequestParam(value="loginId", required = false) String cby){
return activity.getServiceProviderPendingList(cby);
}
@PostMapping(value="/updateServiceProviderImg")
public List<?> updateServiceProviderImg(
@RequestParam(value="did", required = true) String did,
@RequestParam(value = "file", required = true) MultipartFile filedata2
){
return activity.updateServiceProviderImg(did,filedata2);
}
@GetMapping(value="/getZoneWiseCount")

78
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/swmbwg/service/activity.java

@ -187,12 +187,13 @@ public class activity {
public List<Map<String, Object>> saveRequest(String latitude,
String longitude, String zone, String ward, String streetid, String streetname, String location,
String classtxt, String type, String qtyofwaste, String onsiteprocessing,
String serviceprovider, String serviceproviderid, String cby, MultipartFile file) {
String serviceprovider, String serviceproviderid, String cby, MultipartFile file, MultipartFile file2) {
List<Map<String, Object>> result = null;
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
String image = "";
String image2 = "";
// Handle file upload if a file is provided
if (file != null && !file.isEmpty()) {
@ -201,13 +202,21 @@ public class activity {
image = fileUpload(year, month, file);
}
// Handle file upload if a file is provided
if (file2 != null && !file2.isEmpty()) {
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
image2 = fileUpload(year, month, file2);
}
String processingimg = image;
String serviceproviderimg = image2;
String sqlQuery = "INSERT INTO `swm_bwg_data`"
+ "(`latitude`, `longitude`, `zone`, `ward`, `streetid`, "
+ "`streetname`, `location`, `class`, `type`, `qtyofwaste`, `onsiteprocessing`, "
+ "`processingimg`, `serviceprovider`, `serviceproviderid`, `cby`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ "`processingimg`, `serviceprovider`, `serviceproviderid`, `cby`,`serviceproviderimg`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
@ -231,6 +240,7 @@ public class activity {
ps.setString(13, serviceprovider);
ps.setString(14, serviceproviderid);
ps.setString(15, cby);
ps.setString(16, serviceproviderimg);
return ps;
}
}, keyHolder);
@ -268,6 +278,67 @@ public class activity {
return Collections.singletonList(response);
}
public List<Map<String, Object>> getServiceProviderPendingList(String cby){
String sqlQuery = "SELECT sbd.*,"
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', sbd.processingimg) AS photos, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', sbd.serviceproviderimg) AS providerphotos, "
+ "sbc.name as classname, "
+ "sbt.name as typename, "
+ "spl.name as serviceprovidername "
+ "FROM "
+ "`swm_bwg_data` sbd, "
+ "`swm_bwg_class` sbc, "
+ "`swm_bwg_types` sbt, "
+ "`swm_bwg_service_provider_list` spl "
+ "WHERE (sbd.class=sbc.cid AND sbd.type=sbt.tid AND sbd.serviceproviderid=spl.splid) "
+ "AND(`serviceprovider`='Engaged' AND `cby`= ?) AND `serviceproviderimg`=''";
List<Map<String, Object>> result = jdbcBWGTemplate.queryForList(sqlQuery,cby);
Map<String, Object> response = new HashMap<>();
response.put("status", "Success");
response.put("message", "SWM - BWG Service Provider image upload pending list");
response.put("data", result);
return Collections.singletonList(response);
}
public List<Map<String, Object>> updateServiceProviderImg(String did, MultipartFile file2) {
String image2="";
// Handle file upload if a file is provided
if (file2 != null && !file2.isEmpty()) {
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
image2 = fileUpload(year, month, file2);
}
String sqlQuery = "UPDATE `swm_bwg_data` SET `serviceproviderimg` = ? WHERE `did` = ? ";
jdbcBWGTemplate.update(sqlQuery, image2, did);
String sqlQueryList = "SELECT sbd.*,"
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', sbd.processingimg) AS photos, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', sbd.serviceproviderimg) AS providerphotos, "
+ "sbc.name as classname, "
+ "sbt.name as typename, "
+ "spl.name as serviceprovidername "
+ "FROM "
+ "`swm_bwg_data` sbd, "
+ "`swm_bwg_class` sbc, "
+ "`swm_bwg_types` sbt, "
+ "`swm_bwg_service_provider_list` spl "
+ "WHERE (sbd.class=sbc.cid AND sbd.type=sbt.tid AND sbd.serviceproviderid=spl.splid) "
+ "AND(`serviceprovider`='Engaged' AND `did`= ?)";
List<Map<String, Object>> result = jdbcBWGTemplate.queryForList(sqlQueryList,did);
Map<String, Object> response = new HashMap<>();
response.put("status", "Success");
response.put("message", "SWM - BWG Service Provider image uploaded successfuly");
response.put("data", result);
return Collections.singletonList(response);
}
public List<Map<String, Object>> getZoneWiseCount(){
String sqlQuery = "SELECT sbd.zone, count(sbd.did) totalcount FROM `swm_bwg_data` sbd "
@ -303,6 +374,7 @@ public class activity {
String sqlQuery = "SELECT sbd.*,"
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', sbd.processingimg) AS photos, "
+ "CONCAT('"+fileBaseUrl+"/gccofficialapp/files', sbd.serviceproviderimg) AS providerphotos, "
+ "sbc.name as classname, "
+ "sbt.name as typename, "
+ "spl.name as serviceprovidername "

143
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/controller/APIController.java

@ -0,0 +1,143 @@
package in.gov.chennaicorporation.mobileservice.toilets.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.mobileservice.toilets.service.activity;
@RequestMapping("/gccofficialapp/api/toilets/")
@RestController("gccofficialappstoilets")
public class APIController {
@Autowired
private activity activity;
@GetMapping(value="/getToiletsList")
public List<?> getToiletsList(@RequestParam(value="loginId", required = true) String cby){
return activity.getToiletsList(cby);
}
@PostMapping(value="/updateToiletLocation")
public List<?> updateToiletLocation(
@RequestParam(value="loginId", required = true) String cby,
@RequestParam(value="toilet_id", required = true) String toilet_id,
@RequestParam(value="latitude", required = true) String latitude,
@RequestParam(value="longitude", required = true) String longitude,
@RequestParam(value = "file", required = false) MultipartFile filedata
){
return activity.updateToiletLocation(toilet_id,latitude, longitude, filedata);
}
@GetMapping("/getToiletsListWithButton")
public List<?> getToiletsListWithButton(
@RequestParam(value = "loginId", required = false) String cby) {
return activity.getToiletsListWithButton(cby);
}
@GetMapping(value="/getQuestionsList")
public List<?> getQuestionsList(@RequestParam(value="loginId", required = false) String cby){
return activity.getQuestionsList();
}
@PostMapping(value="/addNewToilet")
public List<?> addNewToilet(
@RequestParam(value="latitude", required = true) String latitude,
@RequestParam(value="longitude", required = true) String longitude,
@RequestParam(value="zone", required = true) String zone,
@RequestParam(value="ward", required = true) String ward,
@RequestParam(value="locality", required = true) String locality,
@RequestParam(value="name", required = true) String name,
@RequestParam(value="loginId", required = false) String cby,
@RequestParam(value = "file", required = false) MultipartFile filedata
){
return activity.addNewToilet(latitude, longitude, zone, ward, name, locality, cby, filedata);
}
@GetMapping("/toiletlistbylatlong")
public List<?> toiletlistbylatlong(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value = "latitude", required = true) String latitude,
@RequestParam(value = "longitude", required = true) String longitude,
@RequestParam(value = "assetid", required = true) String id,
@RequestParam(value = "loginId", required = false) String loginId) {
return activity.toiletlistbylatlong(formData, latitude, longitude,id,loginId);
}
@PostMapping(value="/saveFeedback")
public List<?> saveFeedback(
@RequestParam(value="toilet_id", required = true) String toilet_id,
@RequestParam(value="loginId", required = true) String cby,
@RequestParam(value="latitude", required = true) String latitude,
@RequestParam(value="longitude", required = true) String longitude,
@RequestParam(value="zone", required = true) String zone,
@RequestParam(value="ward", required = true) String ward,
@RequestParam(value="q_1", required = false) String q_1,
@RequestParam(value="q_2", required = false) String q_2,
@RequestParam(value="q_3", required = false) String q_3,
@RequestParam(value="q_4", required = false) String q_4,
@RequestParam(value="q_5", required = false) String q_5,
@RequestParam(value="q_6", required = false) String q_6,
@RequestParam(value="q_7", required = false) String q_7,
@RequestParam(value="q_8", required = false) String q_8,
@RequestParam(value="q_9", required = false) String q_9,
@RequestParam(value="q_10", required = false) String q_10,
@RequestParam(value="q_11", required = false) String q_11,
@RequestParam(value="remarks", required = false) String remarks,
@RequestParam(value = "file", required = true) MultipartFile filedata
){
return activity.saveFeedback(toilet_id, cby, latitude, longitude, zone, ward,
q_1, q_2, q_3, q_4, q_5, q_6, q_7, q_8, q_9, q_10, q_11,
remarks, filedata);
}
@GetMapping(value="/zoneReport")
public List<?> zoneReport(
@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value="fromDate", required = true) String fromDate,
@RequestParam(value="toDate", required = true) String toDate,
@RequestParam(value="loginId", required = false) String cby
){
return activity.zoneReport(formData,fromDate,toDate,cby);
}
@GetMapping(value="/wardReport")
public List<?> wardReport(
@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value="fromDate", required = true) String fromDate,
@RequestParam(value="toDate", required = true) String toDate,
@RequestParam(value="zone", required = true) String zone,
@RequestParam(value="loginId", required = false) String cby
){
return activity.wardReport(formData,fromDate,toDate,zone,cby);
}
@GetMapping(value="/toiletReport")
public List<?> toiletReport(
@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value="fromDate", required = true) String fromDate,
@RequestParam(value="toDate", required = true) String toDate,
@RequestParam(value="ward", required = true) String ward,
@RequestParam(value="loginId", required = false) String cby
){
return activity.toiletReport(formData,fromDate,toDate,ward,cby);
}
@GetMapping(value="/feedbackReport")
public List<?> feedbackReport(
@RequestParam MultiValueMap<String, String> formData,
@RequestParam(value="fromDate", required = true) String fromDate,
@RequestParam(value="toDate", required = true) String toDate,
@RequestParam(value="type", required = true) String type,
@RequestParam(value="toilet_id", required = true) String id,
@RequestParam(value="loginId", required = false) String cby
){
return activity.feedbackReport(formData,fromDate,toDate,type,id,cby);
}
}

1
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/controller/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.mobileservice.toilets.controller;

1
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.mobileservice.toilets;

758
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/service/activity.java

@ -0,0 +1,758 @@
package in.gov.chennaicorporation.mobileservice.toilets.service;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.time.LocalTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.MultiValueMap;
import org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.mobileservice.gccactivity.service.DateTimeUtil;
@Service("gccofficialappstoiletsactivity")
public class activity {
private JdbcTemplate jdbcToiletsTemplate;
private final Environment environment;
private String fileBaseUrl;
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static final int STRING_LENGTH = 15;
private static final Random RANDOM = new SecureRandom();
@Autowired
public void setDataSource(@Qualifier("mysqlToiletsDataSource") DataSource toiletsDataSource) {
this.jdbcToiletsTemplate = new JdbcTemplate(toiletsDataSource);
}
@Autowired
public activity(Environment environment) {
this.environment = environment;
this.fileBaseUrl=environment.getProperty("fileBaseUrl");
}
public static String generateRandomString() {
StringBuilder result = new StringBuilder(STRING_LENGTH);
for (int i = 0; i < STRING_LENGTH; i++) {
result.append(CHARACTERS.charAt(RANDOM.nextInt(CHARACTERS.length())));
}
return result.toString();
}
private byte[] compressImage(BufferedImage image, float quality) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(byteArrayOutputStream);
ImageWriter writer = ImageIO.getImageWritersByFormatName("jpg").next();
writer.setOutput(imageOutputStream);
ImageWriteParam param = writer.getDefaultWriteParam();
if (param.canWriteCompressed()) {
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionQuality(quality);
}
writer.write(null, new javax.imageio.IIOImage(image, null, null), param);
writer.dispose();
imageOutputStream.close();
return byteArrayOutputStream.toByteArray();
}
public String fileUpload(String name, String id, MultipartFile file) {
int lastInsertId = 0;
// Set the file path where you want to save it
String uploadDirectory = environment.getProperty("file.upload.directory");
String serviceFolderName = environment.getProperty("toilets_foldername");
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
uploadDirectory = uploadDirectory + serviceFolderName + year + "/" + month;
try {
// Create directory if it doesn't exist
Path directoryPath = Paths.get(uploadDirectory);
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
// Datetime string
String datetimetxt = DateTimeUtil.getCurrentDateTime();
// File name
String fileName = name + "_" + id + "_" + datetimetxt + "_" + file.getOriginalFilename();
fileName = fileName.replaceAll("\\s+", ""); // Remove space on filename
String filePath = uploadDirectory + "/" + fileName;
String filepath_txt = "/" + serviceFolderName + year + "/" + month + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
// Get the bytes of the file
byte[] bytes = file.getBytes();
// Compress the image
BufferedImage image = ImageIO.read(new ByteArrayInputStream(bytes));
byte[] compressedBytes = compressImage(image, 0.5f); // Compress with 50% quality
// Write the bytes to the file
Files.write(path, compressedBytes);
System.out.println(filePath);
return filepath_txt;
} catch (IOException e) {
e.printStackTrace();
return "Failed to save file " + file.getOriginalFilename();
}
}
public static String getTypeBasedOnTime() {
// Get the current time
LocalTime now = LocalTime.now();
// Define morning and evening time ranges
LocalTime morningStart = LocalTime.of(1, 0); // 1:00 AM
LocalTime eveningStart = LocalTime.of(13, 0); // 1:00 PM
// Check and return the appropriate type
if (now.isAfter(morningStart) && now.isBefore(eveningStart)) {
return "morning";
} else {
return "evening";
}
}
public List<Map<String, Object>> getToiletsList(String loginid) {
String sql = "SELECT *,"
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files',image) AS photo "
+ " FROM `gcc_toilet_list` WHERE `user_id`=? AND `isactive`=1 AND `gcc_app_updated`= 0 ";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sql,loginid);
Map<String, Object> response = new HashMap<>();
response.put("status", "Success");
response.put("message", "Toilets List.");
response.put("data", result);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> updateToiletLocation(String id,String latitude, String longitude, MultipartFile file) {
Map<String, Object> response = new HashMap<>();
String image = "";
// Handle file upload if a file is provided
if (file != null && !file.isEmpty()) {
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
image = fileUpload(year, month, file);
}
String toiletimg = image;
String sql = "UPDATE `gcc_toilet_list` SET `gcc_app_updated`=1, `latitude`=?, longitude=?, `image`=? WHERE `id`=?";
jdbcToiletsTemplate.update(sql, latitude, longitude, toiletimg, id);
response.put("status", "success");
response.put("message", "Toilet Data updated successfully!");
System.out.println("Toilet Data updated successfully!! Update ID: " + id);
return Collections.singletonList(response);
}
public List<Map<String, Object>> getToiletsListWithButton(String loginid) {
/*
String sql = "SELECT "
+ " `gcc_toilet_list`.*, "
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files', `gcc_toilet_list`.`image`) AS photo, "
+ " CASE "
+ " WHEN `toilet_feedback`.`type` = 'morning' THEN true "
+ " ELSE false "
+ " END AS morning_feedback, "
+ " CASE "
+ " WHEN `toilet_feedback`.`type` = 'evening' THEN true "
+ " ELSE false "
+ " END AS evening_feedback "
+ "FROM "
+ " `gcc_toilet_list` "
+ "LEFT JOIN "
+ " `toilet_feedback` "
+ " ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ " AND DATE(`toilet_feedback`.`cdate`) = CURDATE() "
+ "WHERE "
+ " `gcc_toilet_list`.`user_id` = ? "
+ " AND `gcc_toilet_list`.`isactive` = 1";
*/
String sql ="SELECT "
+ " `gcc_toilet_list`.*, "
+ " CONCAT('" + fileBaseUrl + "/gccofficialapp/files', "
+ " CASE "
+ " WHEN `gcc_toilet_list`.`image` IS NULL OR `gcc_toilet_list`.`image` = '' "
+ " THEN `toilet_feedback`.`image` "
+ " ELSE `gcc_toilet_list`.`image` "
+ " END "
+ " ) AS photo, "
+ " MAX(CASE WHEN `toilet_feedback`.`type` = 'morning' THEN true ELSE false END) AS morning_feedback, "
+ " MAX(CASE WHEN `toilet_feedback`.`type` = 'evening' THEN true ELSE false END) AS evening_feedback "
+ "FROM "
+ " `gcc_toilet_list` "
+ "LEFT JOIN "
+ " `toilet_feedback` "
+ " ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ " AND DATE(`toilet_feedback`.`cdate`) = CURDATE() "
+ "WHERE "
+ " `gcc_toilet_list`.`user_id` = ? "
+ " AND `gcc_toilet_list`.`isactive` = 1 AND `gcc_app_updated`= 1 "
+ "GROUP BY "
+ " `gcc_toilet_list`.`id`";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sql,loginid);
Map<String, Object> response = new HashMap<>();
response.put("status", "Success");
response.put("message", "Toilets List with extra info.");
response.put("data", result);
return Collections.singletonList(response);
}
public List<Map<String, Object>> getQuestionsList() {
String sql = "SELECT * FROM question_list WHERE isactive=1";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sql);
Map<String, Object> response = new HashMap<>();
response.put("status", "Success");
response.put("message", "Toilet Question List.");
response.put("data", result);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> addNewToilet(String latitude,
String longitude, String zone, String ward, String name, String locality, String cby, MultipartFile file) {
List<Map<String, Object>> result = null;
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
String image = "";
// Handle file upload if a file is provided
if (file != null && !file.isEmpty()) {
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
image = fileUpload(year, month, file);
}
String toiletimg = image;
String sqlQuery = "INSERT INTO `gcc_toilet_list`("
+ "`zone`, `zone_name`, `ward`, `user_id`, `list`, "
+ "`name`, `locality`, `latitude`, `longitude`, `toilet_availability`, "
+ "`toilet_category`, `toilet_type`, `working_condition`, `refurbishment_type`,`image`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int affectedRows = jdbcToiletsTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sqlQuery, new String[] { "id" });
ps.setString(1, zone);
ps.setString(2, "");
ps.setString(3, ward);
ps.setString(4, cby);
ps.setString(5, "");
ps.setString(6, name);
ps.setString(7, locality);
ps.setString(8, latitude);
ps.setString(9, longitude);
ps.setString(10, "");
ps.setString(11, "");
ps.setString(12, "");
ps.setString(13, "");
ps.setString(14, "");
ps.setString(15, toiletimg);
return ps;
}
}, keyHolder);
if (affectedRows > 0) {
Number generatedId = keyHolder.getKey();
lastInsertId = (generatedId != null) ? generatedId.intValue() : 0;
response.put("insertId", lastInsertId);
response.put("status", "success");
response.put("message", "A new asset was inserted successfully!");
System.out.println("A new asset was inserted successfully! Insert ID: " + generatedId);
} else {
response.put("status", "error");
response.put("message", "Failed to insert a new asset.");
}
} catch (DataAccessException e) {
System.out.println("Data Access Exception:");
Throwable rootCause = e.getMostSpecificCause();
if (rootCause instanceof SQLException) {
SQLException sqlException = (SQLException) rootCause;
System.out.println("SQL State: " + sqlException.getSQLState());
System.out.println("Error Code: " + sqlException.getErrorCode());
System.out.println("Message: " + sqlException.getMessage());
response.put("status", "error");
response.put("message", sqlException.getMessage());
response.put("sqlState", sqlException.getSQLState());
response.put("errorCode", sqlException.getErrorCode());
} else {
System.out.println("Message: " + rootCause.getMessage());
response.put("status", "error");
response.put("message", rootCause.getMessage());
}
}
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> toiletlistbylatlong(
MultiValueMap<String, String> formData,
String latitude,
String longitude,
String id,
String loginid) {
String sqlWhere = "";
if (latitude != null && longitude != null && !latitude.isBlank() && !latitude.isEmpty() && !longitude.isBlank()
&& !longitude.isEmpty()) {
sqlWhere += " AND ((6371008.8 * acos(ROUND(cos(radians(" + latitude
+ ")) * cos(radians(latitude)) * cos(radians(longitude) - radians(" + longitude
+ ")) + sin(radians(" + latitude + ")) * sin(radians(latitude)), 9))) < 200)"
+ " ORDER BY `id` DESC";
}
String sqlQuery = "SELECT *,"
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files',image) AS photo "
+ " FROM `gcc_toilet_list` WHERE `user_id`=? AND `isactive`=1 AND id = ?" // This is the starting part of WHERE clause
+ sqlWhere; // Here the latitude and longitude condition gets appended if provided
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sqlQuery,loginid, id);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Nearby toilet list.");
if(result.isEmpty()) {
response.put("message", "No toilet found nearby.");
}
response.put("data", result);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> saveFeedback(
String toilet_id,
String cby,
String latitude,
String longitude,
String zone,
String ward,
String q_1,
String q_2,
String q_3,
String q_4,
String q_5,
String q_6,
String q_7,
String q_8,
String q_9,
String q_10,
String q_11,
String remarks,
MultipartFile file) {
List<Map<String, Object>> result = null;
Map<String, Object> response = new HashMap<>();
int lastInsertId = 0;
String image = "";
// Handle file upload if a file is provided
if (file != null && !file.isEmpty()) {
var year = DateTimeUtil.getCurrentYear();
var month = DateTimeUtil.getCurrentMonth();
image = fileUpload(year, month, file);
}
String feedbackimg = image;
String type = getTypeBasedOnTime(); // Get Morning & Evening
String sqlQuery = "INSERT INTO `toilet_feedback`("
+ "`toilet_id`, `cby`, "
+ "`q1`, `q2`, `q3`, `q4`, `q5`, `q6`, `q7`, `q8`, `q9`, `q10`, `q11`, "
+ "`remarks`,`latitude`, `longitude`,`zone`,`ward`,`type`,`image`) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
try {
int affectedRows = jdbcToiletsTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sqlQuery, new String[] { "id" });
ps.setString(1, toilet_id);
ps.setString(2, cby);
ps.setString(3, q_1);
ps.setString(4, q_2);
ps.setString(5, q_3);
ps.setString(6, q_4);
ps.setString(7, q_5);
ps.setString(8, q_6);
ps.setString(9, q_7);
ps.setString(10, q_8);
ps.setString(11, q_9);
ps.setString(12, q_10);
ps.setString(13, q_11);
ps.setString(14, remarks);
ps.setString(15, latitude);
ps.setString(16, longitude);
ps.setString(17, zone);
ps.setString(18, ward);
ps.setString(19, type);
ps.setString(20, feedbackimg);
return ps;
}
}, keyHolder);
if (affectedRows > 0) {
Number generatedId = keyHolder.getKey();
lastInsertId = (generatedId != null) ? generatedId.intValue() : 0;
response.put("insertId", lastInsertId);
response.put("status", "success");
response.put("message", "A new feedback was inserted successfully!");
System.out.println("A new feedback was inserted successfully! Insert ID: " + generatedId);
} else {
response.put("status", "error");
response.put("message", "Failed to insert a new feedback. Asset ID:" + toilet_id);
}
} catch (DataAccessException e) {
System.out.println("Data Access Exception:");
Throwable rootCause = e.getMostSpecificCause();
if (rootCause instanceof SQLException) {
SQLException sqlException = (SQLException) rootCause;
System.out.println("SQL State: " + sqlException.getSQLState());
System.out.println("Error Code: " + sqlException.getErrorCode());
System.out.println("Message: " + sqlException.getMessage());
response.put("status", "error");
response.put("message", sqlException.getMessage());
response.put("sqlState", sqlException.getSQLState());
response.put("errorCode", sqlException.getErrorCode());
} else {
System.out.println("Message: " + rootCause.getMessage());
response.put("status", "error");
response.put("message", rootCause.getMessage());
}
}
return Collections.singletonList(response);
}
// Report
@Transactional
public List<Map<String, Object>> zoneReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String loginid) {
String sqlQuery = "SELECT "
+ " `gcc_toilet_list`.`zone`, "
+ " COUNT(DISTINCT `gcc_toilet_list`.`id`) AS Total_Toilets, "
+ " SUM(CASE "
+ " WHEN `gcc_toilet_list`.`gcc_app_updated` = '0' THEN 1 "
+ " ELSE 0 "
+ " END) AS Enumeration_Pending, "
+ " SUM(CASE "
+ " WHEN `toilet_feedback`.`type` = 'morning' THEN 1 "
+ " ELSE 0 "
+ " END) AS Morning_Count, "
+ " SUM(CASE "
+ " WHEN `toilet_feedback`.`type` = 'evening' THEN 1 "
+ " ELSE 0 "
+ " END) AS Evening_Count "
+ "FROM "
+ " `gcc_toilet_list` "
+ "LEFT JOIN "
+ " `toilet_feedback` "
+ " ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ " AND DATE(`toilet_feedback`.`cdate`) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "WHERE "
//+ " `gcc_toilet_list`.`user_id` = ? AND "
+ " `gcc_toilet_list`.`isactive` = 1 "
+ "GROUP BY "
+ " `gcc_toilet_list`.`zone` "
+ "ORDER BY "
+ " `gcc_toilet_list`.`zone`";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sqlQuery, fromDate, toDate);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Zone report.");
if(result.isEmpty()) {
response.put("message", "No data found.");
}
response.put("data", result);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> wardReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String zone,
String loginid) {
String sqlQuery = "SELECT "
+ " `gcc_toilet_list`.`ward`, "
+ " COUNT(DISTINCT `gcc_toilet_list`.`id`) AS Total_Toilets, "
+ " SUM(CASE "
+ " WHEN `gcc_toilet_list`.`gcc_app_updated` = '0' THEN 1 "
+ " ELSE 0 "
+ " END) AS Enumeration_Pending, "
+ " SUM(CASE "
+ " WHEN `toilet_feedback`.`type` = 'morning' THEN 1 "
+ " ELSE 0 "
+ " END) AS Morning_Count, "
+ " SUM(CASE "
+ " WHEN `toilet_feedback`.`type` = 'evening' THEN 1 "
+ " ELSE 0 "
+ " END) AS Evening_Count "
+ "FROM "
+ " `gcc_toilet_list` "
+ "LEFT JOIN "
+ " `toilet_feedback` "
+ " ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ " AND DATE(`toilet_feedback`.`cdate`) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "WHERE "
+ " `gcc_toilet_list`.`zone` = ? AND "
+ " `gcc_toilet_list`.`isactive` = 1 "
+ "GROUP BY "
+ " `gcc_toilet_list`.`ward` "
+ "ORDER BY "
+ " `gcc_toilet_list`.`ward`";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sqlQuery, fromDate, toDate, zone);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Ward report.");
if(result.isEmpty()) {
response.put("message", "No data found.");
}
response.put("data", result);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> toiletReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String ward,
String loginid) {
String sqlQuery = "SELECT "
+ " `gcc_toilet_list`.`id`,`gcc_toilet_list`.`name`,`gcc_toilet_list`.`zone`,`gcc_toilet_list`.`ward`, "
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files', `gcc_toilet_list`.`image`) AS photo,"
+ " SUM(CASE "
+ " WHEN `gcc_toilet_list`.`gcc_app_updated` = '0' THEN 1 "
+ " ELSE 0 "
+ " END) AS Enumeration_Pending, "
+ " SUM(CASE "
+ " WHEN `toilet_feedback`.`type` = 'morning' THEN 1 "
+ " ELSE 0 "
+ " END) AS Morning_Count, "
+ " SUM(CASE "
+ " WHEN `toilet_feedback`.`type` = 'evening' THEN 1 "
+ " ELSE 0 "
+ " END) AS Evening_Count "
+ "FROM "
+ " `gcc_toilet_list` "
+ "LEFT JOIN "
+ " `toilet_feedback` "
+ " ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ " AND DATE(`toilet_feedback`.`cdate`) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "WHERE "
+ " `gcc_toilet_list`.`ward` = ? AND "
+ " `gcc_toilet_list`.`isactive` = 1 "
+ "GROUP BY "
+ " `gcc_toilet_list`.`id` "
+ "ORDER BY "
+ " `gcc_toilet_list`.`id`";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sqlQuery, fromDate, toDate, ward);
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
response.put("message", "Toilet list report.");
if(result.isEmpty()) {
response.put("message", "No data found.");
}
response.put("data", result);
return Collections.singletonList(response);
}
@Transactional
public List<Map<String, Object>> feedbackReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
//String ward,
String type,
String toiletid,
String loginid) {
String sqlQuery = "SELECT "
+ " `gcc_toilet_list`.`id` as assetid, "
+ " `gcc_toilet_list`.`name`, "
+ " `gcc_toilet_list`.`zone`, "
+ " `gcc_toilet_list`.`ward`, "
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files', `gcc_toilet_list`.`image`) AS toiletPhoto, "
+ " DATE_FORMAT(`toilet_feedback`.`cdate`, '%d-%m-%Y %I:%i %p') as feedbackDate, "
+ " `toilet_feedback`.*, "
+ " CONCAT('"+fileBaseUrl+"/gccofficialapp/files', `toilet_feedback`.`image`) AS feedbackPhoto "
+ "FROM "
+ " `gcc_toilet_list` "
+ "RIGHT JOIN "
+ " `toilet_feedback` "
+ " ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ " AND `toilet_feedback`.`type` = ? "
+ " AND DATE(`toilet_feedback`.`cdate`) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') AND STR_TO_DATE(?, '%d-%m-%Y') "
+ "WHERE "
+ " `gcc_toilet_list`.`id` = ? "
+ " AND `gcc_toilet_list`.`isactive` = 1 "
+ "ORDER BY "
+ " feedbackDate";
List<Map<String, Object>> result = jdbcToiletsTemplate.queryForList(sqlQuery, type, fromDate, toDate, toiletid);
// Questions
String sqlQuestion = "SELECT * FROM `question_list`";
List<Map<String, Object>> question = jdbcToiletsTemplate.queryForList(sqlQuestion);
// Prepare response
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
if (result.isEmpty()) {
response.put("message", "No data found.");
response.put("data", Collections.emptyList());
response.put("question", Collections.emptyList());
} else {
response.put("message", "Feedback list report.");
response.put("data", result);
response.put("question", question);
}
return Collections.singletonList(response);
}
/*
@Transactional
public List<Map<String, Object>> feedbackReport(
MultiValueMap<String, String> formData,
String fromDate,
String toDate,
String type,
String toiletid,
String loginid) {
// Fetch feedback data
String sqlQuery = "SELECT `gcc_toilet_list`.`id` as assetid,`gcc_toilet_list`.`name`,`gcc_toilet_list`.`zone`,"
+ "`gcc_toilet_list`.`ward`, CONCAT('https://gccservices.in/gccofficialapp/files', `gcc_toilet_list`.`image`) AS toiletPhoto,"
+ " DATE(`toilet_feedback`.`cdate`) as feedbackDate, "
+ "`toilet_feedback`.*, CONCAT('https://gccservices.in/gccofficialapp/files', `toilet_feedback`.`image`) AS feedbackPhoto "
+ "FROM `gcc_toilet_list` JOIN `toilet_feedback` ON `toilet_feedback`.`toilet_id` = `gcc_toilet_list`.`id` "
+ "AND `toilet_feedback`.`type` = ? "
+ "AND DATE(`toilet_feedback`.`cdate`) BETWEEN STR_TO_DATE(?, '%d-%m-%Y') "
+ "AND STR_TO_DATE(?, '%d-%m-%Y') WHERE `gcc_toilet_list`.`id` = ? "
+ "AND `gcc_toilet_list`.`isactive` = 1 GROUP BY `gcc_toilet_list`.`id` ORDER BY feedbackDate";
List<Map<String, Object>> feedbackData = jdbcToiletsTemplate.queryForList(sqlQuery, type, fromDate, toDate, toiletid);
// Fetch question data
String sqlQuestion = "SELECT * FROM `question_list`";
List<Map<String, Object>> questionData = jdbcToiletsTemplate.queryForList(sqlQuestion);
// Map questions by ID for easy lookup
Map<String, Map<String, Object>> questionMap = new HashMap<>();
for (Map<String, Object> question : questionData) {
questionMap.put("q" + question.get("id"), question);
}
// Enrich feedback data with question English and Tamil fields
for (Map<String, Object> feedback : feedbackData) {
for (int i = 1; i <= 7; i++) { // Assuming there are 7 questions (q1 to q7)
String questionKey = "q" + i;
if (feedback.containsKey(questionKey)) {
Map<String, Object> question = questionMap.get(questionKey);
if (question != null) {
feedback.put(questionKey + "_english", question.get("q_english"));
feedback.put(questionKey + "_tamil", question.get("q_tamil"));
} else {
feedback.put(questionKey + "_english", null);
feedback.put(questionKey + "_tamil", null);
}
}
}
}
// Prepare response
Map<String, Object> response = new HashMap<>();
response.put("status", 200);
if (feedbackData.isEmpty()) {
response.put("message", "No data found.");
response.put("data", Collections.emptyList());
} else {
response.put("message", "Feedback list report.");
response.put("data", feedbackData);
}
return Collections.singletonList(response);
}
*/
}

1
mobileservice/src/main/java/in/gov/chennaicorporation/mobileservice/toilets/service/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.mobileservice.toilets.service;

BIN
mobileservice/src/main/resources/.DS_Store

19
mobileservice/src/main/resources/application.properties

@ -26,6 +26,7 @@ spring.servlet.multipart.max-file-size=20MB
# Maximum request size (including all files)
spring.servlet.multipart.max-request-size=20MB
spring.mvc.favicon.enabled=false
fileBaseUrl=https://gccservices.in
@ -33,12 +34,14 @@ file.upload.directory=${user.dir}/gcc_mobile_service_uploads/
activity_foldername = asset_activity/
activity_new_asset_foldername = asset_images/
brr_activity_foldername= brr_activity_images/
sos_activity_foldername= sos_rescue_activity_images/
penalty_foldername=penalty_activity/
straydogs_foldername=stray_dogs/
gccschools_foldername=schools_images/
parks_playground_foldername=parks_playground_images/
swm_bwg_foldername=swm_bwg/
cattlecatch_foldername=cattlecatch_activity/
brr_activity_foldername = brr_activity_images/
sos_activity_foldername = sos_rescue_activity_images/
penalty_foldername = penalty_activity/
straydogs_foldername = stray_dogs/
gccschools_foldername = schools_images/
parks_playground_foldername = parks_playground_images/
swm_bwg_foldername = swm_bwg/
cattlecatch_foldername = cattlecatch_activity/
hoardings_foldername = hoardings_activity/
toilets_foldername = toilets_activity/

BIN
mobileservice/src/main/resources/static/assets/favicon.ico

BIN
mobileservice/src/main/resources/static/favicon.ico

Loading…
Cancel
Save