9 changed files with 5647 additions and 5 deletions
-
1376hs_err_pid29156.log
-
6pom.xml
-
17src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
-
5src/main/java/com/gcc/commissionerreview/controller/MainController.java
-
159src/main/java/com/gcc/commissionerreview/controller/RoadWarApiController.java
-
68src/main/java/com/gcc/commissionerreview/service/RoadWarPdfBorder.java
-
1288src/main/java/com/gcc/commissionerreview/service/RoadWarService.java
-
2src/main/resources/application.properties
-
2729src/main/resources/templates/modules/roadwarweb/misreport.html
1376
hs_err_pid29156.log
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,159 @@ |
|||
package com.gcc.commissionerreview.controller; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.gcc.commissionerreview.service.RoadWarService; |
|||
|
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/roadwarweb") |
|||
public class RoadWarApiController { |
|||
|
|||
@Autowired |
|||
private RoadWarService roadWarService; |
|||
|
|||
@GetMapping("/getzones") |
|||
public Map<String, Object> ViewZoneDropdown() { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
List<Map<String, Object>> zones = roadWarService.ViewZoneDropdown(); |
|||
|
|||
if (!zones.isEmpty()) { |
|||
response.put("status", true); |
|||
response.put("message", "Zone list fetched successfully"); |
|||
response.put("data", zones); |
|||
} else { |
|||
response.put("status", false); |
|||
response.put("message", "No zones found"); |
|||
response.put("data", Collections.emptyList()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
@GetMapping("/getwardbyzone") |
|||
public Map<String, Object> ViewWardDropdown(@RequestParam String zone) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
List<Map<String, Object>> wards = roadWarService.ViewWardDropdown(zone); |
|||
|
|||
if (!wards.isEmpty()) { |
|||
response.put("status", true); |
|||
response.put("message", "Ward list fetched successfully"); |
|||
response.put("data", wards); |
|||
} else { |
|||
response.put("status", false); |
|||
response.put("message", "No wards found"); |
|||
response.put("data", Collections.emptyList()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
@GetMapping("/getRoadType") |
|||
public Map<String, Object> getRoadType() { |
|||
Map<String, Object> response = new HashMap<>(); |
|||
List<Map<String, Object>> roadTypes = roadWarService.getRoadType(); |
|||
if (!roadTypes.isEmpty()) { |
|||
response.put("status", true); |
|||
response.put("message", "Road types fetched successfully"); |
|||
response.put("data", roadTypes); |
|||
} else { |
|||
response.put("status", false); |
|||
response.put("message", "No road types found"); |
|||
response.put("data", Collections.emptyList()); |
|||
} |
|||
return response; |
|||
} |
|||
|
|||
@GetMapping("/getoverallcount") |
|||
public List<Map<String,Object>> getoverallcount(){ |
|||
return roadWarService.getoverallcount(); |
|||
} |
|||
|
|||
@GetMapping("/getzonereport") |
|||
public List<Map<String,Object>> getzonereport( |
|||
@RequestParam (required = false) String zone, |
|||
@RequestParam (required = false) String ward, |
|||
@RequestParam (required = false) String region, |
|||
@RequestParam (required = false) String road_type, |
|||
@RequestParam (required = false) String is_footpath, |
|||
@RequestParam (required = false) String is_swd |
|||
){ |
|||
return roadWarService.getzonereport(zone,ward,region,road_type,is_footpath,is_swd); |
|||
} |
|||
|
|||
@GetMapping("/getwardreport") |
|||
public List<Map<String,Object>> getwardreport( |
|||
@RequestParam (required = false) String zone, |
|||
@RequestParam (required = false) String ward, |
|||
@RequestParam (required = false) String region, |
|||
@RequestParam (required = false) String road_type, |
|||
@RequestParam (required = false) String is_footpath, |
|||
@RequestParam (required = false) String is_swd |
|||
){ |
|||
return roadWarService.getwardreport(zone,ward,region,road_type,is_footpath,is_swd); |
|||
} |
|||
|
|||
@GetMapping("/getwardpending") |
|||
public List<Map<String,Object>> getwardpending( |
|||
@RequestParam (required = false) String zone, |
|||
@RequestParam (required = false) String ward, |
|||
@RequestParam (required = false) String region, |
|||
@RequestParam (required = false) String road_type, |
|||
@RequestParam (required = false) String is_footpath, |
|||
@RequestParam (required = false) String is_swd |
|||
){ |
|||
return roadWarService.getwardpending(zone,ward,region,road_type,is_footpath,is_swd); |
|||
} |
|||
|
|||
@GetMapping("/getwardpartiallycompletion") |
|||
public List<Map<String,Object>> getwardpartiallycompletion( |
|||
@RequestParam (required = false) String zone, |
|||
@RequestParam (required = false) String ward, |
|||
@RequestParam (required = false) String region, |
|||
@RequestParam (required = false) String road_type, |
|||
@RequestParam (required = false) String is_footpath, |
|||
@RequestParam (required = false) String is_swd |
|||
){ |
|||
return roadWarService.getwardpartiallycompletion(zone,ward,region,road_type,is_footpath,is_swd); |
|||
} |
|||
|
|||
@GetMapping("/getwardcompletion") |
|||
public List<Map<String,Object>> getwardcompletion( |
|||
@RequestParam (required = false) String zone, |
|||
@RequestParam (required = false) String ward, |
|||
@RequestParam (required = false) String region, |
|||
@RequestParam (required = false) String road_type, |
|||
@RequestParam (required = false) String is_footpath, |
|||
@RequestParam (required = false) String is_swd |
|||
){ |
|||
return roadWarService.getwardcompletion(zone,ward,region,road_type,is_footpath,is_swd); |
|||
} |
|||
|
|||
@GetMapping("/getRoadWarDetailsById") |
|||
public Map<String, Object> getRoadWarDetailsById(@RequestParam String refid){ |
|||
return roadWarService.getRoadWarDetailsById(refid); |
|||
} |
|||
|
|||
@GetMapping("/downloadRoadWarPdf") |
|||
public void downloadRoadWarPdf( |
|||
@RequestParam String refId, |
|||
HttpServletResponse response) throws Exception { |
|||
|
|||
roadWarService.downloadRoadWarPdf(refId, response); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
package com.gcc.commissionerreview.service; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
|
|||
import com.itextpdf.text.Document; |
|||
import com.itextpdf.text.Element; |
|||
import com.itextpdf.text.Rectangle; |
|||
import com.itextpdf.text.pdf.BaseFont; |
|||
import com.itextpdf.text.pdf.ColumnText; |
|||
import com.itextpdf.text.pdf.PdfContentByte; |
|||
import com.itextpdf.text.pdf.PdfPageEventHelper; |
|||
import com.itextpdf.text.pdf.PdfWriter; |
|||
|
|||
public class RoadWarPdfBorder extends PdfPageEventHelper { |
|||
|
|||
@Override |
|||
public void onEndPage(PdfWriter writer, Document document) { |
|||
|
|||
PdfContentByte cb = writer.getDirectContent(); |
|||
|
|||
// Draw Border |
|||
Rectangle rect = new Rectangle( |
|||
document.left(), |
|||
document.bottom(), |
|||
document.right(), |
|||
document.top()); |
|||
|
|||
rect.setBorder(Rectangle.BOX); |
|||
rect.setBorderWidth(1.5f); |
|||
|
|||
cb.rectangle(rect); |
|||
|
|||
// Footer |
|||
try { |
|||
|
|||
BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, |
|||
BaseFont.CP1252, |
|||
BaseFont.NOT_EMBEDDED); |
|||
|
|||
String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date()); |
|||
String time = new SimpleDateFormat("HH:mm:ss").format(new Date()); |
|||
|
|||
// Left Side - Date |
|||
ColumnText.showTextAligned( |
|||
cb, |
|||
Element.ALIGN_LEFT, |
|||
new com.itextpdf.text.Phrase("Generated on : " + date, |
|||
new com.itextpdf.text.Font(bf, 9)), |
|||
document.left(), |
|||
document.bottom() - 15, |
|||
0); |
|||
|
|||
// Right Side - Time |
|||
ColumnText.showTextAligned( |
|||
cb, |
|||
Element.ALIGN_RIGHT, |
|||
new com.itextpdf.text.Phrase("Time : " + time, |
|||
new com.itextpdf.text.Font(bf, 9)), |
|||
document.right(), |
|||
document.bottom() - 15, |
|||
0); |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
|||
1288
src/main/java/com/gcc/commissionerreview/service/RoadWarService.java
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
spring.profiles.active=prod |
|||
spring.profiles.active=dev |
|||
2729
src/main/resources/templates/modules/roadwarweb/misreport.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue