List of usage examples for org.apache.commons.lang WordUtils capitalize
public static String capitalize(String str)
Capitalizes all the whitespace separated words in a String.
From source file:org.egov.stms.notice.service.SewerageNoticeService.java
public ReportOutput generateReportOutputDataForRejection( final SewerageApplicationDetails sewerageApplicationDetails, final HttpSession session, final HttpServletRequest request) { final List<Assignment> assignList = assignmentService.getAllActiveAssignments( designationService.getDesignationByName(SewerageTaxConstants.DESIGNATION_COMMISSIONER).getId()); ReportRequest reportInput = null;//from w w w . j av a 2 s .co m final Map<String, Object> reportParams = new HashMap<>(); if (sewerageApplicationDetails != null) { final AssessmentDetails assessmentDetails = sewerageTaxUtils.getAssessmentDetailsForFlag( sewerageApplicationDetails.getConnectionDetail().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS); String ownerName = ""; if (null != assessmentDetails.getOwnerNames()) for (final OwnerName names : assessmentDetails.getOwnerNames()) { ownerName = names.getOwnerName(); break; } reportParams.put(APPLICATION_TYPE, WordUtils.capitalize(sewerageApplicationDetails.getApplicationType().getName())); reportParams.put("applicantName", ownerName); reportParams.put("cityName", session.getAttribute("citymunicipalityname")); reportParams.put("remarks", request.getParameter("approvalComent")); reportParams.put("rejectionDate", getDefaultFormattedDate(sewerageApplicationDetails.getRejectionDate())); reportParams.put("rejectionNumber", sewerageApplicationDetails.getRejectionNumber()); reportParams.put(PRESENT_COMMISSIONER, assignList == null ? StringUtils.EMPTY : assignList.get(0).getEmployee().getName()); reportInput = new ReportRequest(REJECTION_NOTICE, sewerageApplicationDetails, reportParams); } return reportService.createReport(reportInput); }
From source file:org.egov.stms.notice.service.SewerageNoticeService.java
public ReportOutput generateReportOutputForWorkOrder( final SewerageApplicationDetails sewerageApplicationDetails) { ReportRequest reportInput = null;//from w w w .ja v a 2 s .c o m final Map<String, Object> reportParams = new HashMap<>(); if (null != sewerageApplicationDetails) { final AssessmentDetails assessmentDetails = sewerageTaxUtils.getAssessmentDetailsForFlag( sewerageApplicationDetails.getConnectionDetail().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS); final String[] doorno = assessmentDetails.getPropertyAddress().split(","); String ownerName = ""; for (final OwnerName names : assessmentDetails.getOwnerNames()) { ownerName = names.getOwnerName(); break; } if (sewerageApplicationDetails.getApplicationType() != null) reportParams.put("conntitle", WordUtils.capitalize(sewerageApplicationDetails.getApplicationType().getName())); final User user = securityUtils.getCurrentUser(); List<Assignment> loggedInUserAssignmentForRegistration; String loggedInUserDesignationForReg; loggedInUserAssignmentForRegistration = assignmentService.getAssignmentByPositionAndUserAsOnDate( sewerageApplicationDetails.getCurrentState().getOwnerPosition().getId(), user.getId(), new Date()); loggedInUserDesignationForReg = !loggedInUserAssignmentForRegistration.isEmpty() ? loggedInUserAssignmentForRegistration.get(0).getDesignation().getName() : null; if (loggedInUserDesignationForReg != null && SewerageTaxConstants.DESIGNATION_COMMISSIONER .equalsIgnoreCase(loggedInUserDesignationForReg)) reportParams.put(IS_COMMISSIONER, true); else reportParams.put(IS_COMMISSIONER, false); reportParams.put("userSignature", user.getSignature() == null ? new ByteArrayInputStream(new byte[0]) : new ByteArrayInputStream(user.getSignature())); reportParams.put("applicationtype", stmsMessageSource.getMessage("msg.new.sewerage.conn", null, null)); reportParams.put("municipality", cityService.getMunicipalityName()); reportParams.put(DISTRICT, cityService.getDistrictName()); reportParams.put("purpose", null); reportParams.put(PRESENT_COMMISSIONER, assignmentService .getAllActiveAssignments(designationService .getDesignationByName(SewerageTaxConstants.DESIGNATION_COMMISSIONER).getId()) .get(0).getEmployee().getName()); if (sewerageApplicationDetails.getApplicationType().getCode() .equalsIgnoreCase(SewerageTaxConstants.NEWSEWERAGECONNECTION)) { for (final SewerageConnectionFee scf : sewerageApplicationDetails.getConnectionFees()) if (scf.getFeesDetail().getCode() .equalsIgnoreCase(SewerageTaxConstants.FEES_ESTIMATIONCHARGES_CODE)) estimationCharges = BigDecimal.valueOf(scf.getAmount()); else if (scf.getFeesDetail().getCode() .equalsIgnoreCase(SewerageTaxConstants.FEES_DONATIONCHARGE_CODE)) donationCharges = BigDecimal.valueOf(scf.getAmount()); else if (scf.getFeesDetail().getCode() .equalsIgnoreCase(SewerageTaxConstants.FEES_SEWERAGETAX_CODE)) sewerageCharges = BigDecimal.valueOf(scf.getAmount()); } else if (sewerageApplicationDetails.getCurrentDemand() != null) { final Map<String, BigDecimal> donationSewerageFeesDtls = getFeesForChangeInClosets( sewerageApplicationDetails.getCurrentDemand()); estimationCharges = donationSewerageFeesDtls.get(ESTIMATION_CHARGES); donationCharges = donationSewerageFeesDtls.get(DONATION_CHARGES); sewerageCharges = donationSewerageFeesDtls.get(SEWERAGE_TAX); } reportParams.put("cityLogo", cityService.getCityLogoURL()); reportParams.put(ESTIMATION_CHARGES, estimationCharges); reportParams.put(DONATION_CHARGES, donationCharges); reportParams.put(SEWERAGE_TAX, sewerageCharges); reportParams.put(TOTAL_CHARGES, donationCharges.add(sewerageCharges).add(estimationCharges)); reportParams.put(ASSESSMENT_NO, sewerageApplicationDetails.getConnectionDetail().getPropertyIdentifier()); reportParams.put(NO_OF_SEATS_RESIDENTIAL, sewerageApplicationDetails.getConnectionDetail().getNoOfClosetsResidential() == null ? 0 : sewerageApplicationDetails.getConnectionDetail().getNoOfClosetsResidential()); reportParams.put(NO_OF_SEATS_NON_RESIDENTIAL, sewerageApplicationDetails.getConnectionDetail().getNoOfClosetsNonResidential() == null ? 0 : sewerageApplicationDetails.getConnectionDetail().getNoOfClosetsNonResidential()); reportParams.put("revenueWardNo", assessmentDetails.getBoundaryDetails().getWardName()); reportParams.put("locality", assessmentDetails.getBoundaryDetails().getLocalityName()); reportParams.put("workorderdate", sewerageApplicationDetails.getWorkOrderDate() != null ? getDefaultFormattedDate(sewerageApplicationDetails.getWorkOrderDate()) : ""); reportParams.put("workorderno", sewerageApplicationDetails.getWorkOrderNumber()); if (sewerageApplicationDetails.getConnection().getShscNumber() != null) reportParams.put("consumerNumber", sewerageApplicationDetails.getConnection().getShscNumber()); reportParams.put("applicantname", WordUtils.capitalize(ownerName)); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put("doorno", doorno[0]); reportParams.put(APPLICATION_DATE, getDefaultFormattedDate(sewerageApplicationDetails.getApplicationDate())); reportInput = new ReportRequest(SANCTION_NOTICE, sewerageApplicationDetails, reportParams); } return reportService.createReport(reportInput); }
From source file:org.egov.stms.notice.service.SewerageNoticeService.java
public ReportOutput generateReportOutputForSewerageCloseConnection( final SewerageApplicationDetails sewerageApplicationDetails, final HttpSession session) { ReportRequest reportInput = null;/*from w ww . j a v a 2 s .c o m*/ final Map<String, Object> reportParams = new HashMap<>(); if (null != sewerageApplicationDetails) { final AssessmentDetails assessmentDetails = sewerageTaxUtils.getAssessmentDetailsForFlag( sewerageApplicationDetails.getConnectionDetail().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS); final String[] doorno = assessmentDetails.getPropertyAddress().split(","); String ownerName = ""; for (final OwnerName names : assessmentDetails.getOwnerNames()) { ownerName = names.getOwnerName(); break; } reportParams.put("conntitle", WordUtils.capitalize(sewerageApplicationDetails.getApplicationType().getName())); reportParams.put("municipality", session.getAttribute("citymunicipalityname")); reportParams.put(DISTRICT, session.getAttribute("districtName")); reportParams.put(PRESENT_COMMISSIONER, assignmentService .getAllActiveAssignments(designationService .getDesignationByName(SewerageTaxConstants.DESIGNATION_COMMISSIONER).getId()) .get(0).getEmployee().getName()); reportParams.put(ASSESSMENT_NO, sewerageApplicationDetails.getConnectionDetail().getPropertyIdentifier()); reportParams.put(NO_OF_SEATS_RESIDENTIAL, sewerageApplicationDetails.getConnectionDetail().getNoOfClosetsResidential()); reportParams.put(NO_OF_SEATS_NON_RESIDENTIAL, sewerageApplicationDetails.getConnectionDetail().getNoOfClosetsNonResidential()); reportParams.put("revenueWardNo", assessmentDetails.getBoundaryDetails().getWardName()); reportParams.put("locality", assessmentDetails.getBoundaryDetails().getLocalityName()); reportParams.put("eeApprovalDate", getDefaultFormattedDate(sewerageApplicationDetails.getLastModifiedDate())); reportParams.put("consumerNumber", sewerageApplicationDetails.getConnection().getShscNumber()); reportParams.put("applicantname", WordUtils.capitalize(ownerName)); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put("doorno", doorno[0]); reportParams.put(APPLICATION_DATE, getDefaultFormattedDate(sewerageApplicationDetails.getApplicationDate())); reportInput = new ReportRequest(CLOSECONNECTIONNOTICE, sewerageApplicationDetails, reportParams); } return reportService.createReport(reportInput); }
From source file:org.egov.stms.transactions.service.SewerageApplicationDetailsService.java
public ReportOutput getReportParamsForSewerageAcknowdgement( final SewerageApplicationDetails sewerageApplicationDetails, final String municipalityName, final String cityName) { final Map<String, Object> reportParams = new HashMap<>(); String ownerName = ""; reportParams.put(MUNICIPALITY, municipalityName); reportParams.put(CITYNAME, cityName); final AssessmentDetails assessmentDetails = sewerageTaxUtils.getAssessmentDetailsForFlag( sewerageApplicationDetails.getConnectionDetail().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS); if (null != assessmentDetails.getOwnerNames()) for (final OwnerName names : assessmentDetails.getOwnerNames()) { ownerName = names.getOwnerName(); break; }// www . java2 s . c o m reportParams.put(ZONE_NAME, assessmentDetails.getBoundaryDetails() != null ? assessmentDetails.getBoundaryDetails().getZoneName() : ""); reportParams.put(ELECTION_WARD, assessmentDetails.getBoundaryDetails() != null ? assessmentDetails.getBoundaryDetails().getWardName() : ""); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put(APPLICANT_NAME, ownerName); reportParams.put(ACKNOWLEDGEMENT_NO, sewerageApplicationDetails.getApplicationNumber()); final SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); reportParams.put(CURRENT_DATE, formatter.format(new Date())); reportParams.put(DUE_DATE, formatter.format(calculateDueDate(sewerageApplicationDetails))); reportParams.put(PARTY_S_COPY, PARTY_S_COPY); reportParams.put(OFFICE_S_COPY, OFFICE_S_COPY); reportParams.put(APPLICATION_CENTRE, stmsMessageSource.getMessage("msg.application.centre", new String[] {}, Locale.getDefault())); reportParams.put(APP_TYPE, WordUtils.capitalize(sewerageApplicationDetails.getApplicationType().getName())); final ReportRequest reportInput = new ReportRequest("sewerageAcknowledgementReceipt", sewerageApplicationDetails, reportParams); return reportService.createReport(reportInput); }
From source file:org.egov.wtms.application.service.ReportGenerationService.java
public ReportOutput getReportOutput(WaterConnectionDetails connectionDetails, String workFlowAction) { Map<String, Object> reportParams = new ConcurrentHashMap<>(0); ReportRequest reportInput = null;/*from w w w. j a v a 2 s . c o m*/ ReportOutput reportOutput; User user = securityUtils.getCurrentUser(); if (connectionDetails != null) { AssessmentDetails assessmentDetails = propertyExtnUtils.getAssessmentDetailsForFlag( connectionDetails.getConnection().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS, BasicPropertyStatus.ALL); String propAddress = assessmentDetails.getPropertyAddress(); String[] doorno = null; double total = 0; if (isNotBlank(propAddress)) doorno = propAddress.split(","); String ownerName = ""; Iterator<OwnerName> iterator = null; if (!assessmentDetails.getOwnerNames().isEmpty()) iterator = assessmentDetails.getOwnerNames().iterator(); if (iterator != null && iterator.hasNext()) ownerName = iterator.next().getOwnerName(); List<Assignment> assignList = assignmentService.findPrimaryAssignmentForDesignationName(DESG_COMM_NAME); String commissionerName = ""; if (!assignList.isEmpty()) commissionerName = assignList.get(0).getEmployee().getName(); if (NEWCONNECTION.equalsIgnoreCase(connectionDetails.getApplicationType().getCode())) reportParams.put(APPLICATIONTYPE, wcmsMessageSource.getMessage("msg.new.watertap.conn", null, null)); else if (ADDNLCONNECTION.equalsIgnoreCase(connectionDetails.getApplicationType().getCode())) reportParams.put(APPLICATIONTYPE, wcmsMessageSource.getMessage("msg.add.watertap.conn", null, null)); else reportParams.put(APPLICATIONTYPE, wcmsMessageSource.getMessage("msg.changeofuse.watertap.conn", null, null)); reportParams.put(CONNTITLE, WordUtils.capitalize(connectionDetails.getApplicationType().getName())); reportParams.put("municipality", cityService.getMunicipalityName()); reportParams.put("currentInstallment", installmentDao.getInsatllmentByModuleForGivenDate( moduleService.getModuleByName(PROPERTY_MODULE_NAME), new Date())); reportParams.put("pipeSize", connectionDetails.getPipeSize().getSizeInInch()); if (NON_METERED.equals(connectionDetails.getConnectionType())) reportParams.put("rate", connectionDemandService .getWaterRatesDetailsForDemandUpdate(connectionDetails).getMonthlyRate()); reportParams.put(DISTRICT, cityService.getDistrictName()); reportParams.put("purpose", connectionDetails.getUsageType().getName()); reportParams.put(WORK_ORDER_DATE, connectionDetails.getWorkOrderDate() == null ? EMPTY : toDefaultDateFormat(connectionDetails.getWorkOrderDate())); reportParams.put(WORK_ORDER_NO, connectionDetails.getWorkOrderNumber() == null ? EMPTY : connectionDetails.getWorkOrderNumber()); reportParams.put(USER_ID, user.getId()); Assignment assignment = assignmentService.getPrimaryAssignmentForUser(user.getId()); if (assignment == null) { List<Assignment> assignmentList = assignmentService.findByEmployeeAndGivenDate(user.getId(), new Date()); if (!assignmentList.isEmpty()) assignment = assignmentList.get(0); } String userDesignation = EMPTY; if (assignment != null) userDesignation = assignment.getDesignation().getName(); reportParams.put(WORK_FLOW_ACTION, workFlowAction); reportParams.put(CONSUMERNUMBER, connectionDetails.getConnection().getConsumerCode()); reportParams.put(APPLICANT_NAME, WordUtils.capitalize(ownerName)); reportParams.put(ADDRESS, propAddress); reportParams.put(HOUSE_NO, doorno == null ? EMPTY : doorno[0]); reportParams.put("userSignature", user.getSignature() == null ? new byte[0] : new ByteArrayInputStream(user.getSignature())); FieldInspectionDetails inspectionDetails = connectionDetails.getFieldInspectionDetails(); reportParams.put("estimationDate", toDefaultDateFormat(inspectionDetails.getCreatedDate())); reportParams.put("estimationNumber", isNotBlank(connectionDetails.getEstimationNumber()) ? connectionDetails.getEstimationNumber() : EMPTY); reportParams.put(PROPERTYID, connectionDetails.getConnection().getPropertyIdentifier()); reportParams.put(APPLICATION_DATE, toDefaultDateFormat(connectionDetails.getApplicationDate())); reportParams.put(DONATION_CHARGES, connectionDetails.getDonationCharges()); reportParams.put(SECURITY_DEPOSIT, inspectionDetails.getSecurityDeposit()); reportParams.put(ROAD_CUTTING_CHARGES, inspectionDetails.getRoadCuttingCharges()); reportParams.put(SUPERVISION_CHARGES, inspectionDetails.getSupervisionCharges()); reportParams.put(LOCALITY, assessmentDetails.getBoundaryDetails().getLocalityName()); total = connectionDetails.getDonationCharges() + inspectionDetails.getSecurityDeposit() + inspectionDetails.getRoadCuttingCharges() + inspectionDetails.getSupervisionCharges(); reportParams.put("total", total); reportParams.put(COMMISSIONER_NAME, commissionerName); reportParams.put(DESIGNATION, userDesignation); reportInput = new ReportRequest( connectionDetails.getConnectionType().equals(NON_METERED) ? "wtr_sanction_order_notice" : CONNECTION_WORK_ORDER, connectionDetails, reportParams); } reportOutput = reportService.createReport(reportInput); return reportOutput; }
From source file:org.egov.wtms.application.service.ReportGenerationService.java
public ReportOutput generateReconnectionReport(WaterConnectionDetails waterConnectionDetails, String workFlowAction) {//from w w w.j av a 2 s. co m Map<String, Object> reportParams = new HashMap<>(); ReportRequest reportInput; ReportOutput reportOutput = null; if (waterConnectionDetails != null) if (waterConnectionDetails.getReconnectionFileStore() == null) { Assignment assignment; AssessmentDetails assessmentDetails = propertyExtnUtils.getAssessmentDetailsForFlag( waterConnectionDetails.getConnection().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS, BasicPropertyStatus.ALL); String[] doorNo = assessmentDetails.getPropertyAddress().split(","); String ownerName = ""; Iterator<OwnerName> iterator = null; if (!assessmentDetails.getOwnerNames().isEmpty()) iterator = assessmentDetails.getOwnerNames().iterator(); if (iterator != null && iterator.hasNext()) ownerName = iterator.next().getOwnerName(); Position approverPos = waterTaxUtils.getCityLevelCommissionerPosition("Commissioner", waterConnectionDetails.getConnection().getPropertyIdentifier()); User user = null; if (approverPos != null) { assignment = assignmentService.getPrimaryAssignmentForPositionAndDate(approverPos.getId(), new Date()); List<Assignment> asignList = new ArrayList<>(); if (assignment != null && assignment.getEmployee() != null) { asignList.add(assignment); } else if (assignment == null) asignList = assignmentService.getAssignmentsForPosition(approverPos.getId(), new Date()); if (!asignList.isEmpty()) user = userService.getUserById(asignList.get(0).getEmployee().getId()); } reportParams.put(APPLICATION_TYPE, WordUtils.capitalize(RECONNECTIONWITHSLASH)); reportParams.put(CITY_NAME, cityService.getMunicipalityName()); reportParams.put(DISTRICT, cityService.getDistrictName()); reportParams.put(APPLICATION_DATE, toDefaultDateFormat(waterConnectionDetails.getApplicationDate())); reportParams.put("reconnApprovalDate", toDefaultDateFormat( waterConnectionDetails.getReconnectionApprovalDate() == null ? new Date() : waterConnectionDetails.getReconnectionApprovalDate())); reportParams.put(APPLICANT_NAME, ownerName); reportParams.put(WATERCHARGES_CONSUMERCODE, waterConnectionDetails.getConnection().getConsumerCode()); reportParams.put(COMMISSIONER_NAME, user != null && user.getUsername() != null ? user.getName() : ownerName); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put(HOUSE_NO, doorNo[0]); User currentUser = securityUtils.getCurrentUser(); reportParams.put("usersignature", currentUser.getSignature() == null ? new byte[0] : new ByteArrayInputStream(currentUser.getSignature())); reportParams.put(USER_ID, currentUser.getId()); reportParams.put(WORK_FLOW_ACTION, workFlowAction); reportInput = new ReportRequest(RECONNECTION_ESTIMATION_NOTICE, waterConnectionDetails, reportParams); reportOutput = reportService.createReport(reportInput); } else reportOutput = getReconnAcknowledgement(waterConnectionDetails); return reportOutput; }
From source file:org.egov.wtms.application.service.ReportGenerationService.java
public ReportOutput generateClosureConnectionReport(WaterConnectionDetails waterConnectionDetails, String workFlowAction) {/*ww w .j a va2s . c o m*/ final Map<String, Object> reportParams = new HashMap<>(); ReportRequest reportInput; ReportOutput reportOutput = null; if (waterConnectionDetails != null) if (waterConnectionDetails.getClosureFileStore() == null) { AssessmentDetails assessmentDetails = propertyExtnUtils.getAssessmentDetailsForFlag( waterConnectionDetails.getConnection().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS, BasicPropertyStatus.ALL); String[] doorNo = assessmentDetails.getPropertyAddress().split(","); StringBuilder ownerName = new StringBuilder(); for (OwnerName names : assessmentDetails.getOwnerNames()) { if (assessmentDetails.getOwnerNames().size() > 1) ownerName.append(", "); ownerName.append(names.getOwnerName()); } reportParams.put(APPLICATION_TYPE, WordUtils.capitalize(CLOSURECONN)); reportParams.put(CITY_NAME, cityService.getMunicipalityName()); reportParams.put(DISTRICT, cityService.getDistrictName()); reportParams.put(APPLICATION_DATE, toDefaultDateFormat(waterConnectionDetails.getApplicationDate())); reportParams.put(APPLICANT_NAME, ownerName); reportParams.put(WATERCHARGES_CONSUMERCODE, waterConnectionDetails.getConnection().getConsumerCode()); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put(HOUSE_NO, doorNo[0]); User currentUser = securityUtils.getCurrentUser(); reportParams.put("usersignature", currentUser.getSignature() == null ? new byte[0] : new ByteArrayInputStream(currentUser.getSignature())); reportParams.put("closeApprovalDate", toDefaultDateFormat(waterConnectionDetails.getCloseApprovalDate() == null ? new Date() : waterConnectionDetails.getCloseApprovalDate())); reportParams.put("closeConnectionType", waterConnectionDetails.getCloseConnectionType().equals("T") ? "Temporary" : "Permanent"); reportParams.put(USER_ID, currentUser.getId()); reportParams.put(WORK_FLOW_ACTION, workFlowAction); reportInput = new ReportRequest(CLOSURE_ESTIMATION_NOTICE, waterConnectionDetails.getEstimationDetails(), reportParams); reportOutput = reportService.createReport(reportInput); } else reportOutput = getClosureAcknowledgement(waterConnectionDetails); return reportOutput; }
From source file:org.egov.wtms.application.service.ReportGenerationService.java
public ReportOutput generateEstimationNoticeReport(WaterConnectionDetails waterConnectionDetails, String cityMunicipalityName, String districtName) { ReportRequest reportInput = null;/*from www . j a v a 2 s .c o m*/ if (waterConnectionDetails != null) { Map<String, Object> reportParams = new HashMap<>(); AssessmentDetails assessmentDetails = propertyExtnUtils.getAssessmentDetailsForFlag( waterConnectionDetails.getConnection().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS, BasicPropertyStatus.ACTIVE); String[] doorNo = assessmentDetails.getPropertyAddress().split(","); StringBuilder ownerName = new StringBuilder(); for (OwnerName names : assessmentDetails.getOwnerNames()) { if (assessmentDetails.getOwnerNames().size() > 1) ownerName.append(", "); ownerName.append(names.getOwnerName()); } reportParams.put(APPLICATION_TYPE, WordUtils.capitalize(waterConnectionDetails.getApplicationType().getName())); reportParams.put(CITY_NAME, cityMunicipalityName); reportParams.put(DISTRICT, districtName); reportParams.put("estimationNumber", isNotBlank(waterConnectionDetails.getEstimationNumber()) ? waterConnectionDetails.getEstimationNumber() : EMPTY); FieldInspectionDetails inspectionDetails = waterConnectionDetails.getFieldInspectionDetails(); reportParams.put("estimationDate", toDefaultDateFormat(inspectionDetails.getCreatedDate())); reportParams.put(DONATION_CHARGES, waterConnectionDetails.getDonationCharges()); double totalCharges = waterConnectionDetails.getDonationCharges() + inspectionDetails.getSupervisionCharges() + inspectionDetails.getRoadCuttingCharges() + inspectionDetails.getSecurityDeposit(); reportParams.put("totalCharges", totalCharges); reportParams.put(APPLICATION_DATE, toDefaultDateFormat(waterConnectionDetails.getApplicationDate())); reportParams.put(APPLICANT_NAME, ownerName.toString()); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put(LOCALITY, assessmentDetails.getBoundaryDetails().getLocalityName()); reportParams.put(HOUSE_NO, doorNo[0]); reportParams.put(PROPERTYID, waterConnectionDetails.getConnection().getPropertyIdentifier()); reportParams.put("amountInWords", getTotalAmntInWords(totalCharges)); reportParams.put(SECURITY_DEPOSIT, inspectionDetails.getSecurityDeposit()); reportParams.put(ROAD_CUTTING_CHARGES, inspectionDetails.getRoadCuttingCharges()); reportParams.put(SUPERVISION_CHARGES, inspectionDetails.getSupervisionCharges()); if (waterConnectionDetails.getConnectionType().equals(NON_METERED)) { reportParams.put("estimationDetails", waterConnectionDetails.getEstimationDetails()); reportParams.put(DESIGNATION, waterConnectionDetails.getState().getOwnerPosition().getDeptDesig() .getDesignation().getName()); reportInput = new ReportRequest("wtr_estimation_notice_for_non_metered", waterConnectionDetails.getEstimationDetails(), reportParams); } else { reportInput = new ReportRequest(ESTIMATION_NOTICE, waterConnectionDetails, reportParams); } } ReportOutput reportOutput; reportOutput = reportService.createReport(reportInput); return reportOutput; }
From source file:org.egov.wtms.application.service.ReportGenerationService.java
public ReportRequest setReportParameters(final Map<String, Object> reportParams, final WaterConnectionDetails waterConnectionDetails) { final String districtName = cityService.getDistrictName(); reportParams.put("cityUrl", (cityService.findAll().isEmpty() ? districtName.toLowerCase() : cityService.findAll().get(0).getName().toLowerCase()) + ".cdma.ap.gov.in"); if (reportParams.get(APPLICATION_TYPE) == null) reportParams.put(APPLICATION_TYPE, WordUtils.capitalize(waterConnectionDetails.getApplicationType().getName())); reportParams.put(CITY_NAME, cityService.getMunicipalityName()); reportParams.put(DISTRICT, districtName); reportParams.put("applicationNumber", waterConnectionDetails.getApplicationNumber()); reportParams.put(APPLICATION_DATE, toDefaultDateFormat(waterConnectionDetails.getApplicationDate())); reportParams.put(PROPERTYID, waterConnectionDetails.getConnection().getPropertyIdentifier()); if (waterConnectionDetails.getCloseConnectionType() != null) if ("T".equals(waterConnectionDetails.getCloseConnectionType())) waterConnectionDetails.setCloseConnectionType(TEMPERARYCLOSE); else if ("P".equals(waterConnectionDetails.getCloseConnectionType())) waterConnectionDetails.setCloseConnectionType(PERMENENTCLOSE); reportParams.put("closeconnectiontype", waterConnectionDetails.getCloseConnectionType()); if (waterConnectionDetails.getCloseconnectionreason() != null) reportParams.put("closeconnectionreason", waterConnectionDetails.getCloseconnectionreason()); if (waterConnectionDetails.getReConnectionReason() != null) reportParams.put("reconnectionreason", waterConnectionDetails.getReConnectionReason()); return new ReportRequest(CITIZEN_ACKNOWLDGEMENT, waterConnectionDetails, reportParams); }
From source file:org.egov.wtms.application.service.ReportGenerationService.java
public ReportOutput generateWorkOrderNotice(WaterConnectionDetails connectionDetails, String workFlowAction) { ReportRequest reportInput = null;/*from w ww. j ava 2 s. c om*/ ReportOutput reportOutput = null; if (connectionDetails != null) if (connectionDetails.getFileStore() == null) { Map<String, Object> reportParams = new HashMap<>(); AssessmentDetails assessmentDetails = propertyExtnUtils.getAssessmentDetailsForFlag( connectionDetails.getConnection().getPropertyIdentifier(), PropertyExternalService.FLAG_FULL_DETAILS, BasicPropertyStatus.ACTIVE); String[] doorno = assessmentDetails.getPropertyAddress().split(","); reportParams.put(DOORNO, doorno[0]); String ownerName = ""; String commissionerName = ""; Iterator<OwnerName> iterator = null; if (!assessmentDetails.getOwnerNames().isEmpty()) iterator = assessmentDetails.getOwnerNames().iterator(); if (iterator != null && iterator.hasNext()) ownerName = iterator.next().getOwnerName(); reportParams.put(APPLICANT_NAME, WordUtils.capitalize(ownerName)); Designation designation = designationService.getDesignationByName(DESG_COMM_NAME); if (designation != null) { List<Assignment> assignList = assignmentService.getAllActiveAssignments(designation.getId()); commissionerName = assignList.isEmpty() ? EMPTY : assignList.get(0).getEmployee().getName(); } if (NEWCONNECTION.equalsIgnoreCase(connectionDetails.getApplicationType().getCode())) { reportParams.put(CONNTITLE, WordUtils.capitalize(connectionDetails.getApplicationType().getName())); reportParams.put(APPLICATION_TYPE, wcmsMessageSource.getMessage("msg.new.watertap.conn", null, null)); } else if (ADDNLCONNECTION.equalsIgnoreCase(connectionDetails.getApplicationType().getCode())) { reportParams.put(CONNTITLE, WordUtils.capitalize(connectionDetails.getApplicationType().getName())); reportParams.put(APPLICATION_TYPE, wcmsMessageSource.getMessage("msg.add.watertap.conn", null, null)); } else { reportParams.put(CONNTITLE, WordUtils.capitalize(connectionDetails.getApplicationType().getName())); reportParams.put(APPLICATION_TYPE, wcmsMessageSource.getMessage("msg.changeofuse.watertap.conn", null, null)); } reportParams.put("municipality", cityService.getMunicipalityName()); reportParams.put(DISTRICT, cityService.getDistrictName()); reportParams.put("purpose", connectionDetails.getUsageType().getName()); User user = securityUtils.getCurrentUser(); Assignment assignment = assignmentService.getPrimaryAssignmentForUser(user.getId()); if (assignment == null) { List<Assignment> assignmentList = assignmentService.findByEmployeeAndGivenDate(user.getId(), new Date()); if (!assignmentList.isEmpty()) assignment = assignmentList.get(0); } String userDesignation = EMPTY; if (assignment != null && assignment.getDesignation().getName().equals(DESG_COMM_NAME)) userDesignation = assignment.getDesignation().getName(); reportParams.put(DESIGNATION, userDesignation); reportParams.put(WORK_ORDER_DATE, connectionDetails.getWorkOrderDate() == null ? EMPTY : toDefaultDateFormat(connectionDetails.getWorkOrderDate())); reportParams.put(WORK_ORDER_NO, connectionDetails.getWorkOrderNumber() == null ? EMPTY : connectionDetails.getWorkOrderNumber()); reportParams.put(USER_ID, user.getId()); reportParams.put(WORK_FLOW_ACTION, workFlowAction); reportParams.put(ADDRESS, assessmentDetails.getPropertyAddress()); reportParams.put(LOCALITY, assessmentDetails.getBoundaryDetails().getLocalityName()); reportParams.put(COMMISSIONER_NAME, commissionerName); setReportParameters(reportParams, connectionDetails); reportOutput = reportService.createReport(reportInput); reportOutput.setReportName(connectionDetails.getWorkOrderNumber()); reportOutput.setReportFormat(ReportFormat.PDF); } else reportOutput = getWorkOrderNotice(connectionDetails); return reportOutput; }