/** * 生成收款单 * * @param client 客户数据 * @param validate 初始校验日期 * @param calendar 当前时间 * @param cycle */ private void paybleFactory(Client client, Date validate, Calendar calendar, int cycle) { int maxDate = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); int month = calendar.get(Calendar.MONTH) + 1; String monthStr = addZero(month); PhfeeInfo phfeeInfo = new PhfeeInfo(); phfeeInfo.setClientCode(client.getClientCode()); phfeeInfo.setCheckFlag("SJZT_00"); phfeeInfo.setRemark(client.getPropertyHealthRemark()); phfeeInfo.setOrgSysCode(client.getOrgSysCode()); // 当每月最大日期小于收款日期,则按该月最大日期为收款日期 if (maxDate < validate.getDate()) { phfeeInfo.setReceiveDate( calendar.get(Calendar.YEAR) + "-" + monthStr + "-" + addZero(maxDate)); } else { calendar.set(Calendar.DATE, validate.getDate()); phfeeInfo.setReceiveDate( calendar.get(Calendar.YEAR) + "-" + monthStr + "-" + addZero(calendar.get(Calendar.DATE))); } // 一次性付款 if (cycle == 0) { int mothCalculate; try { mothCalculate = mothCalculate(client); phfeeInfo.setReceiveRent(client.getMonthlyPayableFee() * mothCalculate); phfeeInfo.setHalthFee(client.getMonthlyHalthFee() * mothCalculate); phfeeInfo.setOtherFee(client.getMonthlyOtherFee() * mothCalculate); } catch (ParseException e) { e.printStackTrace(); } } else { phfeeInfo.setReceiveRent(client.getMonthlyPayableFee() * cycle); phfeeInfo.setHalthFee(client.getMonthlyHalthFee() * cycle); phfeeInfo.setOtherFee(client.getMonthlyOtherFee() * cycle); } phfeeInfoDAO.save(phfeeInfo); }