xuhy
2025-02-26 8ff6842edf6229bb40344eafc4fe084fb09c7d24
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.constant.DictConstants;
import com.ruoyi.common.core.domain.R;
@@ -105,7 +106,7 @@
        tCheckAcceptRecord.setContractId(dto.getId());
        tCheckAcceptRecord.setHouseId(contract.getHouseId());
        tCheckAcceptRecord.setLeaseReason("后台终止合同");
        tCheckAcceptRecord.setStatus("1");
        tCheckAcceptRecord.setStatus(false);
        tCheckAcceptRecord.setAcceptanceTime(LocalDateTime.now());
        LocalDate now = LocalDate.now();
        String replace = (now + "").replace("-", "");
@@ -154,9 +155,12 @@
        if (contract.getStatus().equals("4"))return R.fail("该合同已签订");
        contract.setSignature(dto.getSignature());
        contract.setStatus("4");
        contractMapper.updateById(contract);
        contract.setFirstPayTime(contract.getStartTime().plusDays(10));
        List<TBill> bills = new ArrayList<>();
        contractMapper.updateById(contract);
        // TODO 进入签订审批流程
        List<TContractRentType> contractRentTypes = contractRentTypeService.list();
        // 生成第一笔账单
        // 第一次应缴费日期
@@ -164,7 +168,7 @@
        TBill rentBill = new TBill();
        rentBill.setContractId(contract.getId());
        rentBill.setContractNumber(contract.getContractNumber());
        rentBill.setPayableFeesTime(firstPayTime);
        rentBill.setPayableFeesTime(firstPayTime.toLocalDate());
        if (firstPayTime.toLocalDate().equals(LocalDate.now())){
            rentBill.setPayFeesStatus("1");
        }else {
@@ -240,7 +244,7 @@
        depositBill.setOutstandingMoney(depositBill.getPayableFeesMoney());
        depositBill.setStartTime(contract.getStartPayTime());
        depositBill.setEndTime(contract.getEndTime());
        depositBill.setPayableFeesTime(firstPayTime);
        depositBill.setPayableFeesTime(firstPayTime.toLocalDate());
        if (firstPayTime.toLocalDate().equals(LocalDate.now())){
            depositBill.setPayFeesStatus("1");
@@ -424,11 +428,11 @@
                        }
                        tBill.setContractNumber(contract.getContractNumber());
                        if (beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).getDayOfMonth()<=15){
                            tBill.setPayableFeesTime(contract.getEndTime());
                            tBill.setPayableFeesTime(contract.getEndTime().toLocalDate());
                        }else{
                            tBill.setPayableFeesTime((contract.getPayType().equals("1")?
                                    beforeBill.getEndTime().plusMonths(1).withDayOfMonth(15):contract.getPayType().equals("2")?
                                    beforeBill.getEndTime().plusMonths(3).withDayOfMonth(15):beforeBill.getEndTime().withDayOfMonth(15).plusMonths(12)));
                                    beforeBill.getEndTime().plusMonths(1).withDayOfMonth(15).toLocalDate():contract.getPayType().equals("2")?
                                    beforeBill.getEndTime().plusMonths(3).withDayOfMonth(15).toLocalDate():beforeBill.getEndTime().withDayOfMonth(15).plusMonths(12).toLocalDate()));
                        }
                        tBill.setPayFeesStatus("2");
                        tBill.setBillType("1");
@@ -611,11 +615,11 @@
            }
            tBill.setContractNumber(contract.getContractNumber());
            if (beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1")? 1:contract.getPayType().equals("2")? 3:12).getDayOfMonth()<=15){
                tBill.setPayableFeesTime(contract.getEndTime().withHour(0).withMinute(0).withSecond(0));
                tBill.setPayableFeesTime(contract.getEndTime().withHour(0).withMinute(0).withSecond(0).toLocalDate());
            }else{
                tBill.setPayableFeesTime((contract.getPayType().equals("1")?
                        beforeBill.getEndTime().plusMonths(1).withDayOfMonth(15):contract.getPayType().equals("2")?
                        beforeBill.getEndTime().plusMonths(3).withDayOfMonth(15):beforeBill.getEndTime().withDayOfMonth(15).plusMonths(12).withHour(0).withMinute(0).withSecond(0)));
                        beforeBill.getEndTime().plusMonths(1).withDayOfMonth(15).toLocalDate():contract.getPayType().equals("2")?
                        beforeBill.getEndTime().plusMonths(3).withDayOfMonth(15).toLocalDate():beforeBill.getEndTime().withDayOfMonth(15).plusMonths(12).withHour(0).withMinute(0).withSecond(0).toLocalDate()));
            }
            tBill.setPayFeesStatus("1");
            tBill.setBillType("1");
@@ -638,4 +642,11 @@
        return list;
    }
    @Override
    public Boolean updateContractAuditStatus(String projectId, Integer status) {
        LambdaUpdateWrapper<TContract> contractLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        contractLambdaUpdateWrapper.eq(TContract::getId, projectId).set(TContract::getStatus, status);
        return this.update(contractLambdaUpdateWrapper);
    }
}