renkang
2024-11-28 410227e469df13201cfe7b6d9c254b02fba5e11b
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
@@ -294,11 +294,16 @@
        //处理
        dealBackRentBillBiz(param);
        YwContract update = new YwContract();
        update.setId(param.getId());
        update.setEditDate(new Date());
        update.setEditor(param.getLoginUserInfo().getId());
        update.setBtActDate(update.getEditDate());
        update.setBtActUserId(update.getEditor());
        update.setStatus(Constants.THREE);
        if(Objects.nonNull(param.getBtWaitBill()) && param.getBtWaitBill() > Constants.ZERO){
            update.setStatus(Constants.THREE);
        }else{
            update.setStatus(Constants.FOUR);
        }
        update.setBtInfo(param.getBtInfo());
        update.setBtDate(param.getBtDate());
        update.setBtType(param.getBtType());
@@ -308,6 +313,30 @@
        ywContractMapper.updateById(update);
        dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param));
        return param.getId();
    }
    @Override
    public  void dealTimeOut(){
        //定时处理合同执行中
        ywContractMapper.update(new UpdateWrapper<YwContract>()
                .lambda()
                .set(YwContract::getStatus,Constants.ONE)
                .set(YwContract::getEditDate,DateUtil.getCurrDateTime())
                .eq(YwContract::getIsdeleted,Constants.ZERO)
                .in(YwContract::getStatus,Constants.ZERO)
                .apply(" START_DATE < NOW()  AND END_DATE > NOW() ")
        );
        //定时处理合同已过期
        ywContractMapper.update(new UpdateWrapper<YwContract>()
                        .lambda()
                .set(YwContract::getStatus,Constants.TWO)
                .set(YwContract::getEditDate,DateUtil.getCurrDateTime())
                .eq(YwContract::getIsdeleted,Constants.ZERO)
                .in(YwContract::getStatus,Constants.ONE,Constants.ZERO)
                .apply(" END_DATE < NOW() ")
        );
    }
    private void dealBackRentBillBiz(YwContract param) {
@@ -328,7 +357,7 @@
                //付款状态:0=待收款;1=已结清;2=部分结清;3=待付款;4=待退款;5=已关闭
                // 如果是押金或者保证金,不支持退款,保持原来的状态, 0=租赁费;1=物业费;2=租赁押金;3=物业押金;4=水电费;5=杂项费;6=其他;7=保证金
                if(Constants.equalsInteger(Constants.THREE,bill.getCostType())
                        ||  Constants.equalsInteger(Constants.FOUR,bill.getCostType())
                        ||  Constants.equalsInteger(Constants.TWO,bill.getCostType())
                        ||Constants.equalsInteger(Constants.SEVEN,bill.getCostType())){
                    //押金和保证金
                    yjBills.add(bill);
@@ -466,7 +495,7 @@
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,合同信息不存在,请返回列表刷新重试!");
        }
        SystemUser user = systemUserMapper.selectById(param.getUserId());
        SystemUser user = systemUserMapper.selectById(param.getBtUserId());
        if(user ==null ||  (user.getDeleted()!=null&& user.getDeleted() )){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,经办人信息不存在!");
        }
@@ -538,7 +567,7 @@
            //如果有租赁条款
            if(Constants.formatBigdecimal(model.getZlDeposit()).compareTo(new BigDecimal(0))>0){
                    //如果有租赁押金
                billList1.add(initDepoistBill(Constants.THREE,model,details));
                billList1.add(initDepoistBill(Constants.TWO,model,details));
            }
            if(Constants.equalsInteger(model.getZlPayType(), Constants.ZERO)){
                //如果是一次性付清
@@ -559,7 +588,7 @@
            //如果物业条款
            if(Constants.formatBigdecimal(model.getWyDeposit()).compareTo(new BigDecimal(0))>0){
                //如果有租赁押金
                billList2.add(initDepoistBill(Constants.FOUR,model,details));
                billList2.add(initDepoistBill(Constants.THREE,model,details));
            }
            if(Constants.equalsInteger(model.getWyPayType(), Constants.ZERO)){
                //如果是一次性付清
@@ -578,7 +607,7 @@
        if(model.getBillType() == 0){
            model.setBillList(billList1);
        }else  if(model.getBillType() == 0){
        }else  if(model.getBillType() == 1){
            model.setBillList(billList2);
        }
        int num =1;
@@ -1114,6 +1143,7 @@
                .selectAs(YwCustomer::getName,YwContract::getRenterName )
                .selectAs(YwProject::getName,YwContract::getProjectName )
                .select("t3.realname",YwContract::getCreatorName )
                .select("(select sum(r.area) from yw_contract_room cr left join yw_room r on r.id = cr.room_id where r.isdeleted=0 and cr.contract_id =t.id)",YwContract::getTotalArea )
                .leftJoin(Company.class,Company::getId,YwContract::getCompanyId)
                .leftJoin(SystemUser.class,SystemUser::getId,YwContract::getUserId)
                .leftJoin(SystemUser.class,SystemUser::getId,YwContract::getCreator)