renkang
2024-11-27 b9632baaa11d6e9df2b8fea79f259314bfac1676
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
@@ -538,7 +538,7 @@
            //如果有租赁条款
            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)){
                //如果是一次性付清
@@ -559,7 +559,7 @@
            //如果物业条款
            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)){
                //如果是一次性付清
@@ -599,7 +599,7 @@
        }
    }
    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());
@@ -612,10 +612,18 @@
        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;
    }
@@ -717,12 +725,13 @@
            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);
            bill.setCompanyId(model.getCompanyId());
            list.add(bill);
        }
    }
@@ -840,8 +849,11 @@
    }
    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){