Ejemplo n.º 1
0
  private void calculateFee(
      List<BpaFeeExtn> feeList, RegistrationExtn registration, InspectionExtn inspectionExtn) {

    for (BpaFeeExtn feeObject : feeList) {

      // Check is required to calculate for current service type ?
      if (feeDetailsExtnService.isFeeCalculationRequiredForServiceType(
          inspectionExtn,
          registration,
          feeObject.getFeeCode(),
          registration.getServiceType().getCode())) {
        feeDetailsExtnService.calculateFeeByServiceType(feeObject, registration, inspectionExtn);
      }
    }
  }
Ejemplo n.º 2
0
  @SkipValidation
  public void buildVieworModify(RegistrationExtn registrationObj) {
    LOGGER.debug("Start buildVieworModify");
    if (registrationObj.getEgDemand() != null
        && registrationObj.getEgDemand().getEgDemandDetails() != null) {
      Set<EgDemandDetails> demandDetailsSet = registrationObj.getEgDemand().getEgDemandDetails();
      HashMap<String, BigDecimal> feecodeamountmap = new HashMap<String, BigDecimal>();
      HashMap<String, Long> feecodedemanddetailsIdmap = new HashMap<String, Long>();

      // Getting fee amounts from demand to set into the sanctionfees

      for (EgDemandDetails demandDetails : demandDetailsSet) {
        feecodeamountmap.put(
            demandDetails.getEgDemandReason().getEgDemandReasonMaster().getCode(),
            demandDetails.getAmount());
        feecodedemanddetailsIdmap.put(
            demandDetails.getEgDemandReason().getEgDemandReasonMaster().getCode(),
            demandDetails.getId());
      }

      // Getting fee amounts from registrationdfeedetails to set into the
      // sanctionfees
      RegistrationFeeExtn latesetregistrationFeeObj =
          bpaCommonExtnService.getLatestApprovedRegistrationFee(registrationObj);
      if (latesetregistrationFeeObj != null) {
        Set<RegistrationFeeDetailExtn> regFeeDtlSet =
            latesetregistrationFeeObj.getRegistrationFeeDetailsSet();
        for (RegistrationFeeDetailExtn regFeeDtl : regFeeDtlSet) {
          if (feecodeamountmap.get(regFeeDtl.getBpaFee().getFeeCode()) == null) {
            feecodeamountmap.put(regFeeDtl.getBpaFee().getFeeCode(), regFeeDtl.getAmount());
          }
        }
      }

      santionFeeList =
          feeExtnService.getAllSanctionedFeesbyServiceType(
              registrationObj.getServiceType().getId());
      for (BpaFeeExtn fees : santionFeeList) {
        if (fees.getFeeGroup().equals(BpaConstants.COCFEE)) {
          fees.setFeeAmount(
              feecodeamountmap.get(fees.getFeeCode()) != null
                  ? feecodeamountmap.get(fees.getFeeCode())
                  : BigDecimal.ZERO);
          fees.setDemandDetailId(feecodedemanddetailsIdmap.get(fees.getFeeCode()));
          feeTotal = feeTotal.add(fees.getFeeAmount());
        } else if (fees.getFeeGroup().equals(BpaConstants.CMDAFEE)) {
          fees.setFeeAmount(
              feecodeamountmap.get(fees.getFeeCode()) != null
                  ? feecodeamountmap.get(fees.getFeeCode())
                  : BigDecimal.ZERO);
          fees.setDemandDetailId(feecodedemanddetailsIdmap.get(fees.getFeeCode()));
          feeTotal = feeTotal.add(fees.getFeeAmount());
          // TODO: WE MAY NEED TO PASS DEMANDDETAILID ALONG WITH UI.
        } else if (fees.getFeeGroup().equals(BpaConstants.MWGWFFEE)) {
          fees.setFeeAmount(
              feecodeamountmap.get(fees.getFeeCode()) != null
                  ? feecodeamountmap.get(fees.getFeeCode())
                  : BigDecimal.ZERO);
          fees.setDemandDetailId(feecodedemanddetailsIdmap.get(fees.getFeeCode()));
          feeTotal = feeTotal.add(fees.getFeeAmount());
          // TODO: WE MAY NEED TO PASS DEMANDDETAILID ALONG WITH UI.
        }
      }

      if (latesetregistrationFeeObj != null) {
        registrationObj.setRegistrationFeeChallanNumber(
            latesetregistrationFeeObj.getChallanNumber());

      } else registrationObj.setRegistrationFeeChallanNumber("NA");

      if (latesetregistrationFeeObj != null) {
        setFeeRemarks(latesetregistrationFeeObj.getFeeRemarks());
        registrationObj.setFeeDate(sdf.format(latesetregistrationFeeObj.getFeeDate()));
      } else {
        setFeeRemarks(registrationObj.getFeeRemarks());
        registrationObj.setFeeDate(null); // get date from demanddetl
      }
    }
    splitFeelistintosublists();
    LOGGER.debug("Exit buildVieworModify");
  }