| | |
| | | //如果有租赁条款 |
| | | if(Constants.formatBigdecimal(model.getZlDeposit()).compareTo(new BigDecimal(0))>0){ |
| | | //如果有租赁押金 |
| | | billList1.add(initDepoistBill(Constants.THREE,model)); |
| | | billList1.add(initDepoistBill(Constants.THREE,model,details)); |
| | | } |
| | | if(Constants.equalsInteger(model.getZlPayType(), Constants.ZERO)){ |
| | | //如果是一次性付清 |
| | |
| | | //如果物业条款 |
| | | if(Constants.formatBigdecimal(model.getWyDeposit()).compareTo(new BigDecimal(0))>0){ |
| | | //如果有租赁押金 |
| | | billList2.add(initDepoistBill(Constants.FOUR,model)); |
| | | billList2.add(initDepoistBill(Constants.FOUR,model,details)); |
| | | } |
| | | if(Constants.equalsInteger(model.getWyPayType(), Constants.ZERO)){ |
| | | //如果是一次性付清 |
| | |
| | | } |
| | | } |
| | | |
| | | private YwContractBill initDepoistBill(int type, YwContract model) { |
| | | private YwContractBill initDepoistBill(int type, YwContract model, List<YwContractDetail> details) { |
| | | YwContractBill bill = new YwContractBill(); |
| | | bill.setCreateDate(model.getEditDate()); |
| | | bill.setCreator(model.getEditor()); |
| | |
| | | bill.setEndDate(model.getEndDate()); |
| | | bill.setType(Constants.ZERO); |
| | | bill.setCostType(type); |
| | | YwContractDetail d = details.get(Constants.ZERO); |
| | | if(Objects.isNull(d)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"条款数据异常"); |
| | | } |
| | | Date planPayDate = DateUtil.addDaysToDate(d.getStartDate(),Constants.formatIntegerNum(d.getAdvanceDays()) * -1); |
| | | bill.setPlanPayDate(planPayDate.getTime()>System.currentTimeMillis()?planPayDate:new Date()); |
| | | bill.setTotleFee(type==Constants.THREE?model.getZlDeposit():model.getWyDeposit());//押金费用 |
| | | bill.setReceivableFee(bill.getTotleFee()); |
| | | bill.setBillType(Constants.ZERO); |
| | | bill.setPayStatus(Constants.ZERO); |
| | | bill.setSortnum(0); |
| | | bill.setCompanyId(model.getCompanyId()); |
| | | return bill; |
| | | } |
| | | |
| | |
| | | int monthSix = months / 6;//6个月维度数量 |
| | | int restMonth = months % 6;//剩余的整月 |
| | | int monthDays = dateCompare.getMonthDays();//不满一个月的天数 |
| | | Date date = new Date(); |
| | | List<Date> list = new ArrayList<>(); |
| | | for (int i = 0; i < monthSix; i++) { |
| | | list.add(DateUtil.addMonthToDate(startDate,i*6)); |
| | | list.add(DateUtil.addMonthToDate(date,i*6)); |
| | | } |
| | | if(restMonth>0 || monthDays>0){ |
| | | list.add(DateUtil.addDaysToDate(startDate,monthSix)); |
| | | list.add(DateUtil.addDaysToDate(date,monthSix)); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | int monthThree = months / 3;//3个月维度数量 |
| | | int restMonth = months % 3;//剩余的整月 |
| | | int monthDays = dateCompare.getMonthDays();//不满一个月的天数 |
| | | Date date = new Date(); |
| | | List<Date> list = new ArrayList<>(); |
| | | for (int i = 0; i < monthThree; i++) { |
| | | list.add(DateUtil.addMonthToDate(startDate,i*3)); |
| | | list.add(DateUtil.addMonthToDate(date,i*3)); |
| | | } |
| | | if(restMonth>0 || monthDays>0){ |
| | | list.add(DateUtil.addDaysToDate(startDate,monthThree)); |
| | | list.add(DateUtil.addDaysToDate(date,monthThree)); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | YwContractBill bill = initCreateBillModel(model,d ); |
| | | bill.setStartDate(start);//账单开始 |
| | | bill.setEndDate(end);//账单结束 |
| | | bill.setPlanPayDate(DateUtil.addDaysToDate(d.getStartDate(),Constants.formatIntegerNum(d.getAdvanceDays()) * -1)); |
| | | Date planPayDate = DateUtil.addDaysToDate(d.getStartDate(),Constants.formatIntegerNum(d.getAdvanceDays()) * -1); |
| | | bill.setPlanPayDate(planPayDate.getTime()>System.currentTimeMillis()?planPayDate:new Date()); |
| | | BigDecimal totalFee =getTotalFeeByStartEnd(model,d,freeStart,freeEnd); |
| | | bill.setTotleFee(totalFee); |
| | | bill.setReceivableFee(totalFee); |
| | | bill.setBillType(Constants.ZERO); |
| | | |
| | | temp++; |
| | | bill.setCompanyId(model.getCompanyId()); |
| | | list.add(bill); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private BigDecimal getTotalFeeByStartEnd(YwContract model, YwContractDetail d,Date freeStart,Date freeEnd) { |
| | |
| | | DateCompare dateCompare = DateCompare.monthYearCompare(startDate, endDate ); |
| | | int years = dateCompare.getYear(); |
| | | int yeardays = dateCompare.getYearDays(); |
| | | Date date = new Date(); |
| | | List<Date> list = new ArrayList<>(); |
| | | for (int i = 0; i < years; i++) { |
| | | list.add(DateUtil.addYearToDate(startDate,i)); |
| | | list.add(DateUtil.addYearToDate(date,i)); |
| | | } |
| | | if(yeardays>0){ |
| | | list.add(DateUtil.addYearToDate(startDate,years)); |
| | | list.add(DateUtil.addYearToDate(date,years)); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | } |
| | | |
| | | private void initFiles(YwContract model) { |
| | | List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId, model.getId() ) |
| | | List<Multifile> multifiles = multifileMapper.selectJoinList(Multifile.class,new MPJLambdaWrapper<Multifile>() |
| | | .selectAll(Multifile.class) |
| | | .selectAs(SystemUser::getRealname,Multifile::getUserName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,Multifile::getCreator) |
| | | .eq(Multifile::getObjId,model.getId()) |
| | | .in(Multifile::getObjType, Arrays.asList(new Integer[]{Constants.MultiFile.YW_CONTRACT_FILE.getKey()})) |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO)); |
| | | if(multifiles!=null){ |