无关风月
2025-03-18 da81542b6dc8984f639687f30e7e610dc139b085
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
@@ -31,14 +31,8 @@
import com.ruoyi.common.enums.SubmitStatusEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.system.mapper.TCheckAcceptRecordMapper;
import com.ruoyi.system.model.TBill;
import com.ruoyi.system.model.TCheckAcceptRecord;
import com.ruoyi.system.model.TContract;
import com.ruoyi.system.model.TContractRentType;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.TBillService;
import com.ruoyi.system.service.TContractRentTypeService;
import com.ruoyi.system.service.TContractService;
import com.ruoyi.system.model.*;
import com.ruoyi.system.service.*;
import com.ruoyi.system.task.base.QuartzManager;
import com.ruoyi.system.task.base.TimeJobType;
import com.ruoyi.system.task.jobs.StateProcessJob;
@@ -84,6 +78,7 @@
    private final TContractRentTypeService contractRentTypeService;
    private final TBillService billService;
    private final TCheckAcceptRecordMapper checkAcceptRecordMapper;
    private final THouseService houseService;
    public static void main(String[] args) {
//        LocalDate localDate1 = LocalDate.now().withYear(2025).withMonth(4).withDayOfMonth(1);
@@ -268,16 +263,24 @@
        switch (categoryEnum) {
            case CATEGORY1: {
                // 合同新增审批
                int submitStatus = status == 0 ? 2 : (status == 1 ? 3 : 5);
                int submitStatus = status == 0 ? 2 : (status == 1 ? 3 : 1);
                contractService.updateContractAuditStatus(processParameter.getString("projectId"), submitStatus);
                // TODO 发短信
                break;
            }
            case CATEGORY2: {
                // 合同签订审批
                int submitStatus = status == 0 ? 3 : (status == 1 ? 4 : 5);
                int submitStatus = status == 0 ? 3 : (status == 1 ? 4 : 1);
                contractService.updateContractAuditStatus(processParameter.getString("projectId"), submitStatus);
                TContract contract = contractService.getById(processParameter.getString("projectId"));
                if(contract.getStatus().equals("4")){
                    // 修改房屋状态
                    THouse house = houseService.getById(contract.getHouseId());
                    if(Objects.nonNull(house)){
                        house.setLeaseStatus("2");
                        houseService.updateById(house);
                    }
                List<TContractRentType> contractRentTypes = contractRentTypeService.list();
                TContractRentType tContractRentType = contractRentTypes.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null);
@@ -387,9 +390,7 @@
                            if (beforeBill.getEndTime().plusMonths(contract.getPayType().equals("1") ? 1 : contract.getPayType().equals("2") ? 3 : 12).getDayOfMonth() <= 15) {
                                tBill.setPayableFeesTime(contract.getEndTime().toLocalDate());
                            } else {
                                tBill.setPayableFeesTime((contract.getPayType().equals("1") ?
                                        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.setPayableFeesTime(beforeBill.getEndTime().plusMonths(1).withDayOfMonth(15).toLocalDate());
                            }
                            tBill.setContractId(contract.getId());
                            if (contract.getIsIncreasing()) {
@@ -457,6 +458,7 @@
                                            // 租金递增递减的时长 天
                                            long moneyDays = Math.abs(ChronoUnit.DAYS.between(tContractRentType.getChangeTime(), tBill.getEndTime()))+1;
                                            // 递增递减的租金
                                            BigDecimal contractRentTypeMoney = new BigDecimal("0");
                                            // 不递增递减的租金
                                            BigDecimal originalMoney = new BigDecimal("0");
@@ -639,6 +641,7 @@
                                    tBill.setPayableFeesMoney(contractRentTypeMoney.add(originalMoney));
                                    tBill.setOutstandingMoney(tBill.getPayableFeesMoney());
                                    contractService.updateById(contract);
                                }
                            }
                        } else {
@@ -667,6 +670,7 @@
                    }
                    billService.save(tBill);
                }
                }
                break;
            }
            case CATEGORY3: {