Exemplo n.º 1
0
  public void validate() {
    String actionName = "";
    if (parameters.get(ACTION_NAME) != null && parameters.get(ACTION_NAME)[0] != null)
      actionName = parameters.get(ACTION_NAME)[0];

    if (!(actionName.equalsIgnoreCase(REJECT_ACTION)
        || actionName.equalsIgnoreCase(CANCEL_ACTION))) {
      if (voucherHeader.getVoucherDate() == null)
        addFieldError("voucherDate", getText("arf.payment.voucherdate.required"));
      if (!DateUtils.compareDates(
          voucherHeader.getVoucherDate(), advanceRequisition.getAdvanceRequisitionDate()))
        addFieldError(
            "advanceRequisitionDate",
            getText("arf.payment.voucherdate.lessthan.advancerequisitiondate"));
      if (!DateUtils.compareDates(new Date(), voucherHeader.getVoucherDate()))
        addFieldError(
            "advanceRequisitionDate",
            getText("arf.validate.payment.voucherdate.greaterthan.currentDate"));

      if (StringUtils.isBlank(commonBean.getBankId()) || commonBean.getBankId().equals("-1"))
        addFieldError("commonBean.bankId", getText("arf.bankbranch.required"));

      if (StringUtils.isBlank(commonBean.getAccountNumberId())
          || commonBean.getAccountNumberId().equals("-1"))
        addFieldError("commonBean.accountNumberId", getText("arf.accountnumber.required"));
      if (StringUtils.isBlank(commonBean.getModeOfPayment()))
        addFieldError("commonBean.modeOfPayment", getText("arf.modeOfPayment.required"));
    }
  }
Exemplo n.º 2
0
  private void validateRTGS() {
    EntityType entity = null;
    List<ValidationError> errors = new ArrayList<ValidationError>();
    for (EgAdvanceRequisitionDetails advanceDetail :
        advanceRequisition.getEgAdvanceReqDetailses()) {
      if (!advanceDetail.getEgAdvanceReqpayeeDetailses().isEmpty()) {
        for (EgAdvanceReqPayeeDetails payeeDetail : advanceDetail.getEgAdvanceReqpayeeDetailses()) {
          try {
            entity =
                paymentService.getEntity(
                    payeeDetail.getAccountDetailType().getId(),
                    (Serializable) payeeDetail.getAccountdetailKeyId());
            if (entity == null) {
              throw new ValidationException(
                  Arrays.asList(
                      new ValidationError(
                          "no.entity.for.detailkey",
                          getText(
                              "no.entity.for.detailkey",
                              new String[] {entity.getCode() + "-" + entity.getName()}))));
            }
          } catch (ApplicationException e) {
            throw new ValidationException(
                Arrays.asList(
                    new ValidationError("Exception to get EntityType  ", e.getMessage())));
          }

          if ((StringUtils.isBlank(entity.getPanno())
              || StringUtils.isBlank(entity.getBankname())
              || StringUtils.isBlank(entity.getBankaccount())
              || StringUtils.isBlank(entity.getIfsccode()))) {
            populateBankAccounts(
                Integer.parseInt(commonBean.getBankId().split("-")[1]), fund.getId());
            LOGGER.error(
                getText(
                    "validate.paymentMode.rtgs.subledger.details",
                    new String[] {entity.getCode() + "-" + entity.getName()}));
            errors.add(
                new ValidationError(
                    "validate.paymentMode.rtgs.subledger.details",
                    getText(
                        "validate.paymentMode.rtgs.subledger.details",
                        new String[] {entity.getCode() + "-" + entity.getName()})));
            throw new ValidationException(errors);
          }
        }
      } else {
        throw new ValidationException(
            Arrays.asList(
                new ValidationError(
                    "no.subledger.cannot.create.rtgs.payment",
                    "arf.payment.no.subledger.cannot.create.rtgs.payment")));
      }
    }
  }
  @RequestMapping(method = RequestMethod.POST)
  public String update(
      @Valid @ModelAttribute VacancyRemissionApproval vacancyRemissionApproval,
      final BindingResult resultBinder,
      final RedirectAttributes redirectAttributes,
      final HttpServletRequest request,
      final Model model) {

    String senderName = vacancyRemissionApproval.getCurrentState().getSenderName();
    if (!resultBinder.hasErrors()) {
      String workFlowAction = "";
      if (request.getParameter("workFlowAction") != null)
        workFlowAction = request.getParameter("workFlowAction");

      Long approvalPosition = 0l;
      String approvalComent = "";
      String successMsg = "";

      if (request.getParameter("approvalComent") != null)
        approvalComent = request.getParameter("approvalComent");
      if (request.getParameter("approvalPosition") != null
          && !request.getParameter("approvalPosition").isEmpty())
        approvalPosition = Long.valueOf(request.getParameter("approvalPosition"));

      vacancyRemissionService.saveVacancyRemissionApproval(
          vacancyRemissionApproval, approvalPosition, approvalComent, null, workFlowAction);

      if (StringUtils.isNotBlank(workFlowAction)) {
        if (workFlowAction.equalsIgnoreCase(PropertyTaxConstants.WFLOW_ACTION_STEP_APPROVE)) {
          successMsg =
              "Vacancy Remission Approved Successfully in the System and forwarded to "
                  + vacancyRemissionApproval.getVacancyRemission().getCreatedBy().getUsername();
        } else if (workFlowAction.equalsIgnoreCase(PropertyTaxConstants.WFLOW_ACTION_STEP_REJECT)) {
          if (designation.getName().equalsIgnoreCase(REVENUE_INSPECTOR_DESGN)) {
            successMsg =
                "Vacancy Remission rejected successfully and forwarded to : "
                    + vacancyRemissionApproval.getVacancyRemission().getCreatedBy().getUsername();
          } else {
            successMsg =
                "Vacancy Remission rejected successfully and forwarded to : "
                    + vacancyRemissionApproval.getCreatedBy().getUsername();
          }
        } else {
          successMsg =
              "Vacancy Remission Saved Successfully in the System and forwarded to : "
                  + propertyTaxUtil.getApproverUserName(approvalPosition);
        }
      }

      model.addAttribute("successMessage", successMsg);
      if (StringUtils.isNotBlank(workFlowAction)
          && workFlowAction.equalsIgnoreCase(
              PropertyTaxConstants.WFLOW_ACTION_STEP_NOTICE_GENERATE)) {
        String pathVars =
            vacancyRemissionApproval.getVacancyRemission().getBasicProperty().getUpicNo()
                + ","
                + senderName;
        return "redirect:/vacancyremission/rejectionacknowledgement?pathVar=" + pathVars;
      }
    }
    return "vacancyRemission-success";
  }