From 0edce71202ae32c250d786cb7a08585cdf7409bb Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 06 三月 2025 10:52:59 +0800
Subject: [PATCH] 权限

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java       |    6 ++-
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java  |    4 +
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java              |   49 ++++++++----------------
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java |    7 +--
 ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml        |    1 
 5 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
index 6db2c4f..1df47bd 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -34,59 +34,42 @@
     private TContractService contractService;
     @Autowired
     private TBillService billService;
-    @Autowired
-    private TContractRentTypeService contractRentTypeService;
-
-    // 每天凌晨00点执行的定时任务 用于生成违约金
+    // 用于更新违约金账单
     @Scheduled(cron = "0 0 0 * * ?")
     public void dayOfProportionBill() {
         try {
             // 查询所有未缴费账单
             List<TBill> list = billService.lambdaQuery().eq(TBill::getPayFeesStatus, 1).list();
             for (TBill tBill : list) {
+                if (tBill.getPayableFeesTime().isAfter(LocalDate.now())){
+                    tBill.setPayFeesStatus("4");
+                }
                 TContract contract = contractService.getById(tBill.getContractId());
                 LocalDate payableFeesTime = tBill.getPayableFeesTime();
                 LocalDateTime now = LocalDateTime.now();
                 // 计算两个时间相差多少个小时
                 long hours = ChronoUnit.HOURS.between(payableFeesTime, now);
-                long l = hours / 72;
-                if (l>0){
+                long l = hours / 24;
+                if (l>3){
                     // 违约金比例
                     BigDecimal proportion = contract.getProportion();
-                    // 应缴违约金
-                    BigDecimal money = tBill.getOutstandingMoney().multiply(proportion);
-                    TBill changeBill = new TBill();
-                    changeBill.setId(tBill.getId());
-                    changeBill.setPayableFeesPenalty(money);
-                    billService.lockAndUpdateInfo(changeBill,2);
+                    // 按每天 待缴费金额 * XX% 增加违约金费用
+                    if (tBill.getOutstandingMoney().compareTo(new BigDecimal("0"))==0){
+                        tBill.setPayFeesStatus("3");
+                        billService.updateById(tBill);
+                        continue;
+                    }
+                    BigDecimal money = tBill.getOutstandingMoney().multiply(proportion).setScale(2, BigDecimal.ROUND_DOWN);
+                    tBill.setOverDays((int) l);
+                    tBill.setPayableFeesPenalty((tBill.getPayableFeesPenalty()!=null?tBill.getPayableFeesPenalty():BigDecimal.ZERO).add(money));
                 }
+                billService.updateById(tBill);
             }
 
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
-
-
-
-    // 每天凌晨00点执行的定时任务 根据应缴费日期修改账单状态
-    @Scheduled(cron = "0 0 0 * * ?")
-    public void dayOfEndBill() {
-        try {
-            List<TBill> list = billService.lambdaQuery().eq(TBill::getPayFeesStatus, "2").list();
-            for (TBill tBill : list) {
-                if (tBill.getPayableFeesTime().equals(LocalDate.now())){
-                    tBill.setPayFeesStatus("1");
-                }
-            }
-            billService.updateBatchById(list);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-
-
 
     public static void main(String[] args) {
 
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
index fdc926c..2b9f010 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
@@ -109,6 +109,8 @@
         return R.ok(myToDoVO);
     }
 
+
+
     @ApiOperation(value = "租户-当前在租房源")
     @PostMapping(value = "/tenant/myHouse")
     public R<List<MyHouseVO>> myHouse() {
@@ -132,7 +134,7 @@
                     myToDoVO.setHouseAddress(tHouse.getHouseAddress());
                     myToDoVO.setMonthRent(contract.getMonthRent());
                     myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType()));
-                    myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth() + "月" : bill.getPayFeesTime().getMonth() + "月");
+                    myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth().getValue() + "月" : bill.getPayFeesTime().getMonth().getValue() + "月");
                     myToDoVO.setHouseArea(tHouse.getHouseArea());
                     myToDoVO.setHouseType(tHouse.getHouseType());
                     myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime()));
@@ -180,7 +182,7 @@
                 myToDoVO.setHouseAddress(tHouse.getHouseAddress());
                 myToDoVO.setMonthRent(contract.getMonthRent());
                 myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType()));
-                myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth() + "月" : bill.getPayFeesTime().getMonth() + "月");
+                myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth().getValue() + "月" : bill.getPayFeesTime().getMonth().getValue() + "月");
                 myToDoVO.setHouseArea(tHouse.getHouseArea());
                 myToDoVO.setHouseType(tHouse.getHouseType());
                 myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime()));
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
index f1d04a2..a973153 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
@@ -745,6 +745,7 @@
                 contractService.updateContractAuditStatus(processParameter.getString("projectId"), submitStatus);
                 // 生成验收记录
                 TContract contract = contractService.getById(processParameter.getString("projectId"));
+                contract.setStatus("7");
                 TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord();
                 tCheckAcceptRecord.setContractId(contract.getId());
                 tCheckAcceptRecord.setHouseId(contract.getHouseId());
@@ -758,10 +759,11 @@
                 tCheckAcceptRecord.setCode(replace.substring(2)+String.format("%03d", size+1));
 
 
+
                 checkAcceptRecordMapper.insert(tCheckAcceptRecord);
                 // 将所有未缴费账单设置未已失效
                 List<TBill> tBills = billService.list(new LambdaQueryWrapper<TBill>()
-                        .in(TBill::getPayFeesStatus, Arrays.asList("1,4"))
+                        .in(TBill::getPayFeesStatus, Arrays.asList("1,2,4"))
                         .eq(TBill::getContractId, contract.getId()));
                 for (TBill tBill : tBills) {
                     tBill.setPayFeesStatus("5");
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 672dfbd..d99d5b8 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
@@ -132,11 +132,8 @@
     }
 
     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));
+        String t = "1000438";
+        System.err.println("XN" + String.valueOf(t).substring(1));
     }
     @Override
     public CheckAcceptRecordVO getCheckByContractId(String id) {
diff --git a/ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml
index 217157a..bbc2d5c 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml
@@ -158,6 +158,7 @@
         t.create_by,
         t.update_by,
         t.disabled,
+        t.code,
         i.item_name AS itemName,
         it.type_name AS itemTypeName,
         tnt.resident_name AS residentName

--
Gitblit v1.7.1