renkang
2024-11-28 e5bab3dc2ef0cca716a3f376899575a8179533d2
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
@@ -66,7 +66,7 @@
                || Objects.isNull(ywContractBill.getBillType())
                || Objects.isNull(ywContractBill.getCompanyId())
                || com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywContractBill.getYwContractRoomList())
                || Objects.nonNull(ywContractBill.getFeeType())
                || Objects.isNull(ywContractBill.getFeeType())
                || (Constants.equalsInteger(ywContractBill.getFeeType(),Constants.ZERO)&& (Objects.isNull(ywContractBill.getStartDate())
                || Objects.isNull(ywContractBill.getEndDate())))
        ){
@@ -87,6 +87,23 @@
        ywContractBill.setIsdeleted(Constants.ZERO);
        ywContractBill.setType(Constants.ONE);
        ywContractBill.setStatus(Constants.ZERO);
        if(Constants.equalsInteger(ywContractBill.getBillType(),Constants.ZERO)){
            ywContractBill.setPayStatus(Constants.ZERO);
        }else{
            ywContractBill.setPayStatus(Constants.THREE);
        }
        if(Constants.equalsInteger(ywContractBill.getFeeType(),Constants.ONE)){
            ywContractBill.setStartDate(ywContractBill.getPlanPayDate());
            ywContractBill.setEndDate(ywContractBill.getPlanPayDate());
        }
        //查询合同下的最大的序号
        List<YwContractBill> ywContractBillList = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>().lambda().eq(YwContractBill::getContractId,ywContract.getId()).orderByDesc(YwContractBill::getId));
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBillList)){
            ywContractBill.setSortnum(ywContractBillList.size() + 1 );
        }else{
            ywContractBill.setSortnum(Constants.ZERO);
        }
        ywContractBillMapper.insert(ywContractBill);
        //房源数据
@@ -172,8 +189,10 @@
                        .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from  yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as  actReceivableFee  ")
                        .selectAs(YwContract::getCode,YwContractBill::getContractCode)
                        .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
                        .selectAs(Company::getName,YwContractBill::getCompanyName)
                        .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
                        .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
                        .leftJoin(Company.class,Company::getId,YwContract::getCompanyId)
                        .eq(YwContractBill::getIsdeleted,Constants.ZERO)
                        .eq(YwContractBill::getId,id));
        if(Objects.isNull(ywContractBill)){
@@ -245,6 +264,8 @@
                            YwCustomer::getName,model.getCustomerName())
                    .eq(Objects.nonNull(model)&&Objects.nonNull(model.getStatus()),
                            YwContractBill::getStatus,model.getStatus())
                    .eq(Objects.nonNull(model)&&Objects.nonNull(model.getBillType()),
                            YwContractBill::getBillType,model.getBillType())
                    .eq(Objects.nonNull(model)&&Objects.nonNull(model.getPayStatus()),
                            YwContractBill::getPayStatus,model.getPayStatus())
                    .eq(Objects.nonNull(model)&&Objects.nonNull(model.getType()),
@@ -261,11 +282,12 @@
                    ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
            );
            //是否逾期
            if(Constants.equalsInteger(ywContractBill.getStatus(),Constants.ZERO) && (Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.ZERO)
            if(Constants.equalsInteger(ywContractBill.getStatus(),Constants.ZERO)
                && (Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.ZERO)
            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.TWO)
            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.THREE)
            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.FOUR))
            && ywContractBill.getEndDate().getTime() < System.currentTimeMillis()){
            && ywContractBill.getPlanPayDate().getTime() < System.currentTimeMillis()){
                ywContractBill.setIsOverdue(Constants.ONE);
            }else{
                ywContractBill.setIsOverdue(Constants.ZERO);