From 150e06899ba927d08fdca7f5895b9877bcfda3ea Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 06 十二月 2024 15:47:19 +0800
Subject: [PATCH] 开发更新

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java |   44 ++++++++++++++++++++++++++------------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
index 6e2d2d4..1ba30b7 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
@@ -31,6 +31,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -268,7 +269,7 @@
         }
         model.setTotalArea(new BigDecimal(0));
         for(YwRoom r : rooms){
-            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getArea())));
+            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getRentArea())));
         }
         model.setRoomList(rooms);
     }
@@ -698,12 +699,16 @@
         }
         int num =1;
         for(int i=0;i<billList1.size();i++){
-            billList1.get(i).setSortnum(num);
-            num++;
+            if(Constants.equalsInteger(billList1.get(i).getCostType(),Constants.ZERO)){
+                billList1.get(i).setSortnum(num);
+                num++;
+            }
         }
         for(int i=0;i<billList2.size();i++){
-            billList2.get(i).setSortnum(num);
-            num++;
+            if(Constants.equalsInteger(billList1.get(i).getCostType(),Constants.ONE)) {
+                billList2.get(i).setSortnum(num);
+                num++;
+            }
         }
         if(model.getId()!=null){
             ywContractBillMapper.insert(billList1);
@@ -849,34 +854,37 @@
         BigDecimal totalFee = new BigDecimal(0);
         DateCompare dateCompare =   DateCompare.dayCompare(bill.getStartDate(),bill.getEndDate(),freeStart, freeEnd);
         if(Constants.equalsInteger(d.getCircleType(),Constants.ZERO)){
-            //0=鍏冩瘡骞崇背澶�
+            //0=鍏冩瘡骞崇背澶� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环锛�
             int days = dateCompare.getDay() ;
             BigDecimal areas = getAreasNumBYRooms(model.getRoomList());
             totalFee = new BigDecimal(days).multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.ONE)){
-            //1=鍏冩瘡骞崇背鏈�
+            //1=鍏冩瘡骞崇背鏈� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*绉熻祦闈㈢Н*鍗曚环+涓嶆弧涓�涓湀鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环*12/365锛�
             BigDecimal areas = getAreasNumBYRooms(model.getRoomList());
             BigDecimal month =dateCompare.getMonthFloat();
             totalFee = month.multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.TWO)){
-            //2=鍏冩瘡骞崇背骞�
+            //2=鍏冩瘡骞崇背骞� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*鍗曚环*闈㈢Н/12+涓嶆弧涓�涓湀鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环/365锛�
             BigDecimal areas = getAreasNumBYRooms(model.getRoomList());
-            BigDecimal year =  dateCompare.getYearFloat();
-            totalFee = year.multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
+            BigDecimal month = new BigDecimal(dateCompare.getMonth());
+            totalFee = ((month.multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(12),2, RoundingMode.HALF_UP))
+                    .add(new BigDecimal(dateCompare.getMonthDays()).multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(365),2, RoundingMode.HALF_UP)))
+                    .multiply(areas);//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.THREE)){
-            //3=鍏冩瘡澶�
+            //3=鍏冩瘡澶� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勫ぉ鏁�*鍗曚环锛�
             int days = dateCompare.getDay() ;
             totalFee = new BigDecimal(days).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.FOUR)){
-            //4=鍏冩瘡鏈�
+            //4=鍏冩瘡鏈� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*鍗曚环+涓嶆弧涓�涓湀鐨勫ぉ鏁�*鍗曚环*12/365
             BigDecimal month = dateCompare.getMonthFloat();
             totalFee = month.multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.FIVE)){
-            //5=鍏冩瘡骞�
-            BigDecimal year =  dateCompare.getYearFloat();
-            totalFee = year.multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
+            //5=鍏冩瘡骞� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*鍗曚环*闈㈢Н/12+涓嶆弧涓�涓湀鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环/365锛�
+            BigDecimal month = new BigDecimal(dateCompare.getMonth());
+            totalFee =( month.multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(12),2, RoundingMode.HALF_UP))
+                    .add(new BigDecimal(dateCompare.getMonthDays()).multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(365),2, RoundingMode.HALF_UP));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.SIX)){
-            //6=鍏冩瘡鍦�
+            //6=鍏冩瘡鍦� 璐﹀崟閲戦=鍗曚环锛涘彧鏈夐�夋嫨涓�娆℃�т粯娆炬椂锛屾墠鑳介�夋嫨璇ュ崟浠风淮搴︼紱
             totalFee =Constants.formatBigdecimal(d.getPrice());
         }
         if(Constants.equalsInteger(model.getRoundedUp(),Constants.ONE)){
@@ -947,7 +955,7 @@
         BigDecimal data= new BigDecimal(0);
         if(roomList!=null){
             for(YwRoom r :roomList){
-                data = data.add(Constants.formatBigdecimal(r.getArea()));
+                data = data.add(Constants.formatBigdecimal(r.getRentArea()));
             }
         }
 
@@ -1141,7 +1149,7 @@
         }
         model.setTotalArea(new BigDecimal(0));
         for(YwRoom r : rooms){
-            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getArea())));
+            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getRentArea())));
         }
         model.setRoomList(rooms);
         YwCustomer customer = customerMapper.selectById(model.getRenterId());

--
Gitblit v1.9.3