コード例 #1
0
  public void setDob(Date dob) {
    if (dob != null) {
      setStrDob(DateUtil.convertDateToDateString(dob));
    }

    this.dob = dob;
  }
コード例 #2
0
  public Date getSupplDob() {

    if (getStrSupplDob() != null) {
      this.supplDob = DateUtil.convertDateStringToDate(getStrSupplDob());
    }
    return this.supplDob;
  }
コード例 #3
0
  public Date getIdDate() {

    if (getStrIdDate() != null) {
      this.idDate = DateUtil.convertDateStringToDate(getStrIdDate());
    }
    return this.idDate;
  }
コード例 #4
0
  public Date getCloseDate() {

    if (getStrCloseDate() != null) {
      this.closeDate = DateUtil.convertDateStringToDate(getStrCloseDate());
    }
    return closeDate;
  }
コード例 #5
0
 public void setSupplIdExpire(Date supplIdExpire) {
   this.supplIdExpire = supplIdExpire;
   if (supplIdExpire != null) {
     setStrSupplIdExpire(DateUtil.convertDateToDateString(supplIdExpire));
   }
 }
コード例 #6
0
 public Date getSupplIdExpire() {
   if (getStrSupplIdExpire() != null) {
     this.supplIdExpire = DateUtil.convertDateStringToDate(getStrSupplIdExpire());
   }
   return this.supplIdExpire;
 }
コード例 #7
0
 public void setSupplDob(Date supplDob) {
   this.supplDob = supplDob;
   if (supplDob != null) {
     setStrSupplDob(DateUtil.convertDateToDateString(supplDob));
   }
 }
コード例 #8
0
 public void setOpenDate(Date openDate) {
   this.openDate = openDate;
   if (openDate != null) {
     setStrOpenDate(DateUtil.convertDateToDateString(openDate));
   }
 }
コード例 #9
0
 public Date getOpenDate() {
   if (getStrOpenDate() != null) {
     this.openDate = DateUtil.convertDateStringToDate(getStrOpenDate());
   }
   return openDate;
 }
コード例 #10
0
 public void setIdDate(Date idDate) {
   if (idDate != null) {
     setStrIdDate(DateUtil.convertDateToDateString(idDate));
   }
   this.idDate = idDate;
 }
コード例 #11
0
 public void setExpDate(Date expDate) {
   this.expDate = expDate;
   if (expDate != null) {
     setStrExpDate(DateUtil.convertDateToDateString(expDate));
   }
 }
コード例 #12
0
 public Date getExpDate() {
   if (getStrExpDate() != null) {
     this.expDate = DateUtil.convertDateStringToDate(getStrExpDate());
   }
   return this.expDate;
 }
コード例 #13
0
 public void setCloseDate(Date closeDate) {
   this.closeDate = closeDate;
   if (closeDate != null) {
     setStrCloseDate(DateUtil.convertDateToDateString(closeDate));
   }
 }
コード例 #14
0
  public ActionForward process(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws TPlusException, Exception {

    ActionErrors errors = null;
    boolean isError = false;

    int pageNo = 0;

    if (request.getParameter("pageNo") != null) {
      pageNo = Integer.parseInt((String) request.getParameter("pageNo"));
    }

    String issuerId = (String) request.getSession(false).getAttribute("ISSUER");
    String userId = (String) request.getSession(false).getAttribute("USERID");

    RenewalCardBPForm objForm = (RenewalCardBPForm) form;
    CardBatchProcessManager objCardBatchProcessManager = new CardBatchProcessManager();
    CardManager objCardManager = new CardManager();
    CardProductManager objCardProductManager = new CardProductManager();
    SystemParamManager objSystemParamManager = new SystemParamManager();

    try {

      errors = objForm.validate(mapping, request);

      if (errors != null && !errors.isEmpty()) {
        saveErrors(request, errors);
        isError = true;
      } else {
        errors = new ActionErrors();
        if (objForm.getUserId().equals(objForm.getAuthUserId())) {
          errors.add("Error", new ActionError("error.batchprocesssameusercannot"));
          saveErrors(request, errors);
          isError = true;
        } else {
          AdminLoginDto objDto = new AdminLoginDto();
          objDto.setIssuerId(objForm.getIssuerId());
          objDto.setUserId(objForm.getAuthUserId());
          objDto.setPassword(objForm.getAuthPassword());

          String remoteIp = InetAddress.getLocalHost().getHostAddress();
          objDto.setRemoteIp(remoteIp);

          AdminLoginManager objManager = new AdminLoginManager();
          String rtnMsg = objManager.validateBatchProcessAuthUser(objDto);

          if (!"VALIDUSER".equals(rtnMsg)) {
            errors.add("Error", new ActionError("error.batchprocessauthfailed"));
            saveErrors(request, errors);
            isError = true;
          }
        }
      }

      if (isError) {

        Collection applicationsList =
            objCardBatchProcessManager.listRenewalCardApps(issuerId, pageNo);
        objForm.setAppList(applicationsList);

        int totApps = objCardBatchProcessManager.getTotalRenewalCardsApps(issuerId);
        objForm.setTotalNoOfApps(String.valueOf(totApps));

        request.setAttribute("SEARCHLIST", applicationsList);
        request.setAttribute("PAGENO", new Integer(pageNo).toString());

        return mapping.findForward("success");
      } else {

        Map indexesList = new HashMap();
        KeyIndexManager objKeyIndexManager = new KeyIndexManager();

        // check all the card products have PPK values
        try {
          indexesList = objKeyIndexManager.getIndexesList(issuerId);
          if (indexesList.isEmpty()) {
            errors = new ActionErrors();
            errors.add("Error", new ActionError("error.cardproductsnoindexes"));
            saveErrors(request, errors);

            Collection applicationsList =
                objCardBatchProcessManager.listRenewalCardApps(issuerId, pageNo);
            objForm.setAppList(applicationsList);

            int totApps = objCardBatchProcessManager.getTotalRenewalCardsApps(issuerId);
            objForm.setTotalNoOfApps(String.valueOf(totApps));

            request.setAttribute("SEARCHLIST", applicationsList);
            request.setAttribute("PAGENO", new Integer(pageNo).toString());

            return mapping.findForward("success");
          }
        } catch (Exception e) {
          logger.error(new Object(), e);
          System.out.println("Error on checking PPK for card products " + e);
          throw new TPlusException("Error on checking PPK for card products " + e);
        }

        SystemParamDto objSystemParamDto = objSystemParamManager.get("ASP");
        if (objSystemParamDto == null) {
          errors = new ActionErrors();
          errors.add("Error", new ActionError("error.nosystemparam"));
          saveErrors(request, errors);

          Collection applicationsList =
              objCardBatchProcessManager.listReplacementCardApps(issuerId, pageNo);

          objForm.setAppList(applicationsList);
          request.setAttribute("SEARCHLIST", applicationsList);
          request.setAttribute("PAGENO", new Integer(pageNo).toString());

          return mapping.findForward("success");
        }

        int totalApps = 0;
        RenewalBatchProcessSuccess objRenewalBatchProcessSuccess = null;
        ArrayList appCardsList = new ArrayList();
        StringBuilder genAppsIds = new StringBuilder();
        StringBuilder newCardsNos = new StringBuilder();

        // get all the applications
        ArrayList allApps = objCardBatchProcessManager.getAllRenewalApplication(issuerId);
        totalApps = allApps.size();

        int count = 0;
        int cardCount = 0;
        ArrayList successApps = new ArrayList();

        Iterator itr = allApps.iterator();
        while (itr.hasNext()) {
          CardsRenewalDto objCardsRenewalDto = (CardsRenewalDto) itr.next();

          CardsDto objCardsDto =
              objCardManager.getCard(String.valueOf(objCardsRenewalDto.getCardNumber()));
          CardProductDto objCardProductDto =
              objCardProductManager.getCardProductDto(objCardsDto.getCardProductId());

          ApplicationProcessDto objApplicationProcessDto =
              objCardBatchProcessManager.getCustomerById(objCardsDto.getCustomerId());

          String oldExpDate = objCardsDto.getCardExpDate();
          String extendInterval = "";

          try {
            if (objApplicationProcessDto != null) {

              // assign required fields
              objApplicationProcessDto.setUserId(objForm.getUserId());

              boolean appProcessRes =
                  objCardBatchProcessManager.renewalBatchProcess(
                      objApplicationProcessDto,
                      objCardsDto,
                      indexesList,
                      objCardProductDto,
                      objCardsRenewalDto,
                      objForm.getBatchId(),
                      userId,
                      extendInterval,
                      oldExpDate);
              if (appProcessRes) {
                count++;
                successApps.add(objCardsRenewalDto);
                cardCount++;

                genAppsIds.append("'");
                genAppsIds.append(objCardsRenewalDto.getCardRenewalSerial());
                genAppsIds.append("',");

                newCardsNos.append("'");
                newCardsNos.append(String.valueOf(objCardsRenewalDto.getCardNumber()));
                newCardsNos.append("',");

                objRenewalBatchProcessSuccess = new RenewalBatchProcessSuccess();
                objRenewalBatchProcessSuccess.setApplicationId(
                    objCardsRenewalDto.getCardRenewalSerial());
                objRenewalBatchProcessSuccess.setCustomerName(
                    objApplicationProcessDto.getCustomerName());
                objRenewalBatchProcessSuccess.setOldCardNumber(
                    String.valueOf(objCardsRenewalDto.getCardNumber()));
                objRenewalBatchProcessSuccess.setNewCardNumber(
                    String.valueOf(objCardsRenewalDto.getCardNumber()));
                objRenewalBatchProcessSuccess.setReason("");
                objRenewalBatchProcessSuccess.setAppliedDate(
                    DateUtil.convertDateToDateString(objCardsRenewalDto.getUpdatedDate()));
                appCardsList.add(objRenewalBatchProcessSuccess);
              }
            }
          } catch (Exception e) {
            logger.error(new Object(), e);
            System.out.println("Exception on card number generation " + e);
          }
        }

        // insert into batch
        if (successApps.size() > 0) {
          CardBatchDto objBatchDto = new CardBatchDto();

          if (totalApps == count) {
            objBatchDto.setStatus(CommonCodes.BATCH_COMPLETED);
          } else {
            objBatchDto.setStatus(CommonCodes.BATCH_COMPLETED_PARTIAl);
          }

          objBatchDto.setBatchId(objForm.getBatchId());
          objBatchDto.setNoOfCardsGenerated(cardCount);
          objBatchDto.setErrorMsg("");
          objBatchDto.setAuthorizedBy(objForm.getAuthUserId());
          objBatchDto.setAuthorizedDate(new Date());
          objBatchDto.setUpdateddBy(objForm.getUserId());
          objBatchDto.setUpdatedDate(new Date());

          boolean overallSuccess = objCardBatchProcessManager.addBatch(objBatchDto);
          if (overallSuccess) {

            objForm.setSuccessAppsPrimaryList(appCardsList);
            objForm.setAppIds(
                genAppsIds.toString().substring(0, (genAppsIds.toString().length() - 1)));
            objForm.setNewCardNos(
                newCardsNos.toString().substring(0, (newCardsNos.toString().length() - 1)));

            return mapping.findForward("reportpage");
          }

        } else {

          Collection applicationsList =
              objCardBatchProcessManager.listRenewalCardApps(issuerId, pageNo);
          objForm.setAppList(applicationsList);

          int totApps = objCardBatchProcessManager.getTotalRenewalCardsApps(issuerId);
          objForm.setTotalNoOfApps(String.valueOf(totApps));

          request.setAttribute("SEARCHLIST", applicationsList);
          request.setAttribute("PAGENO", new Integer(pageNo).toString());

          errors.add("Error", new ActionError("error.batchprocessfailed"));
          saveErrors(request, errors);
        }
      }
    } catch (Exception e) {
      logger.error(new Object(), e);
      System.out.println(e);

      Collection applicationsList =
          objCardBatchProcessManager.listRenewalCardApps(issuerId, pageNo);
      objForm.setAppList(applicationsList);

      int totApps = objCardBatchProcessManager.getTotalRenewalCardsApps(issuerId);
      objForm.setTotalNoOfApps(String.valueOf(totApps));

      request.setAttribute("SEARCHLIST", applicationsList);
      request.setAttribute("PAGENO", new Integer(pageNo).toString());

      errors.add("Error", new ActionError("error.applicationerror"));
      saveErrors(request, errors);
    }

    return mapping.findForward("success");
  }