Exemplo n.º 1
0
 /**
  * 根据周期生成收款单
  *
  * @param client 客户数据
  */
 public void costsFactory(Client client) {
   Date startDate;
   try {
     startDate = sdf.parse(client.getHlcRegStartDate());
     Date validate = startDate;
     Date endDate = sdf.parse(client.getHlcRegEndDate());
     Calendar calendar = Calendar.getInstance();
     calendar.setTime(startDate);
     int cycle = getCycle(client);
     // 判断是否是一次性收款
     if (cycle == ONEOFF) {
       calendar.setTime(startDate);
       paybleFactory(client, validate, calendar, cycle);
     } else {
       while (startDate.before(endDate) || startDate.equals(endDate)) {
         paybleFactory(client, validate, calendar, cycle);
         calendar.add(Calendar.MONTH, cycle);
         startDate = calendar.getTime();
       }
     }
   } catch (ParseException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Exemplo n.º 2
0
  /**
   * 计算一次性付款的月差
   *
   * @param client
   * @return 总月数
   * @throws ParseException
   */
  public int mothCalculate(Client client) throws ParseException {
    String startDate = client.getHlcRegStartDate();
    String endDate = client.getHlcRegEndDate();
    Date startTime = sdf.parse(startDate);
    Date endTime = sdf.parse(endDate);
    int countMonth = 0;

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(startTime);
    while (startTime.before(endTime)) {
      calendar.add(Calendar.MONTH, 1);
      countMonth++;
      startTime = calendar.getTime();
    }
    return countMonth;
  }