From 358e4f19e130045ce58c2313435baec2a3f11b61 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 25 二月 2025 10:47:58 +0800
Subject: [PATCH] 审批流

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java |   44 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java
index 5f77e82..61c5b1f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java
+++ b/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;
@@ -104,8 +105,16 @@
         TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord();
         tCheckAcceptRecord.setContractId(dto.getId());
         tCheckAcceptRecord.setHouseId(contract.getHouseId());
-        tCheckAcceptRecord.setLeaseReason("后台终止");
-        tCheckAcceptRecord.setStatus("1");
+        tCheckAcceptRecord.setLeaseReason("后台终止合同");
+        tCheckAcceptRecord.setStatus(false);
+        tCheckAcceptRecord.setAcceptanceTime(LocalDateTime.now());
+        LocalDate now = LocalDate.now();
+        String replace = (now + "").replace("-", "");
+        int size = checkAcceptRecordMapper.selectList(new LambdaQueryWrapper<TCheckAcceptRecord>()
+                .likeRight(TCheckAcceptRecord::getAcceptanceTime, LocalDate.now())).size();
+        tCheckAcceptRecord.setCode(replace.substring(2)+String.format("%03d", size+1));
+
+
         checkAcceptRecordMapper.insert(tCheckAcceptRecord);
         // 将所有未缴费账单设置未已失效
         List<TBill> tBills = billMapper.selectList(new LambdaQueryWrapper<TBill>()
@@ -117,7 +126,13 @@
         billService.updateBatchById(tBills);
     }
 
-
+    public static void main(String[] args) {
+//        LocalDate now = LocalDate.now();
+//        String replace = (now + "").replace("-", "");
+//        System.err.println(replace.substring(2));
+//
+//        System.err.println(String.format("%03d",1));
+    }
     @Override
     public CheckAcceptRecordVO getCheckByContractId(String id) {
         CheckAcceptRecordVO checkAcceptRecordVO = new CheckAcceptRecordVO();
@@ -150,7 +165,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 {
@@ -226,7 +241,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");
 
@@ -410,11 +425,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");
@@ -597,11 +612,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");
@@ -624,4 +639,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);
+    }
 }

--
Gitblit v1.7.1