From 43aa7504b0faa390ae778e6c56d8c4a42e5154ac Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 05 十二月 2024 14:37:07 +0800
Subject: [PATCH] 开发更新

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java |  102 ++++++++++++++++++++++++++-------------------------
 1 files changed, 52 insertions(+), 50 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 4795aa6..4683542 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
@@ -87,7 +87,6 @@
         dealMultifileBiz(model);//澶勭悊闄勪欢淇℃伅
         dealRoomsForContract(model);//澶勭悊鎴挎簮鍏宠仈琛�
         dealLogBiz(model,Constants.YwLogType.CONTRACT_CREATE,model.getLoginUserInfo().getRealname(),"銆�"+model.getRemark().replace("鍚堝悓鎽樿锛�","")+"銆�");//璁板綍鏂板缓鏃ュ織
-
         return model.getId();
     }
 
@@ -194,7 +193,7 @@
             }
             for(YwContractDetail d :model.getWyDetailList()){
                 if(  d.getStartDate() == null
-                        ||d.getEditDate() == null
+                        ||d.getEndDate() == null
                         ||d.getPrice() == null
                         ||d.getCircleType() == null
                         || d.getCircleType()>6
@@ -237,9 +236,9 @@
 
         String str = "";
         //璧风鏃�2024/06/01锛岀璧佹暟涓�500銕°�傞鏈熺璧佷笁鏈堜竴浠橈紝绉熼噾鍗曚环35鍏�/銕÷锋湀銆傞鏈熺墿涓氫笁鏈堜竴浠橈紝鐗╀笟鍗曚环4.3鍏�/銕÷锋湀
-        String str0 = "鍚堝悓鎽樿锛氳捣绉熸棩{param1}锛岀璧佹暟涓簕param2}銕°�傞鏈熺璧亄param3}锛岀閲戝崟浠穥param4}鍏儃param5}銆傞鏈熺墿涓歿param6}锛岀墿涓氬崟浠穥param7}{param8}";
-        String str1 = "鍚堝悓鎽樿锛氳捣绉熸棩{param1}锛岀璧佹暟涓簕param2}銕°�傞鏈熺璧亄param3}锛岀閲戝崟浠穥param4}鍏儃param5}銆�";
-        String str2 = "鍚堝悓鎽樿锛氳捣绉熸棩{param1}锛岄鏈熺墿涓歿param6}锛岀墿涓氬崟浠穥param7}鍏儃param8}";
+        String str0 = "鍚堝悓鎽樿锛氳捣绉熸棩{param1}锛岀璧佹暟涓簕param2}銕°�傞鏈熺璧亄param3}锛岀閲戝崟浠穥param4}{param5}銆傞鏈熺墿涓歿param6}锛岀墿涓氬崟浠穥param7}{param8}";
+        String str1 = "鍚堝悓鎽樿锛氳捣绉熸棩{param1}锛岀璧佹暟涓簕param2}銕°�傞鏈熺璧亄param3}锛岀閲戝崟浠穥param4}{param5}銆�";
+        String str2 = "鍚堝悓鎽樿锛氳捣绉熸棩{param1}锛岄鏈熺墿涓歿param6}锛岀墿涓氬崟浠穥param7}{param8}";
         if(Constants.equalsInteger(model.getType(),Constants.ZERO)){
             str= str0;
         }
@@ -253,10 +252,10 @@
                 .replace("{param2}",model.getTotalArea().intValue()+"")
                 .replace("{param3}",Constants.getPayTypeByNum(model.getZlPayType()))
                 .replace("{param4}",Constants.formatBigdecimal(model.getZlFirstPrice()).intValue()+"")
-                .replace("{param5}",Constants.getUnitTypeByNum(model.getZlFirstCircle())
+                .replace("{param5}",Constants.getUnitTypeByNum(model.getZlFirstCircle()))
                 .replace("{param6}",Constants.getPayTypeByNum(model.getWyPayType()))
                 .replace("{param7}",Constants.formatBigdecimal(model.getWyFirstPrice()).intValue()+"")
-                .replace("{param8}",Constants.getUnitTypeByNum(model.getWyFirstCircle())));
+                .replace("{param8}",Constants.getUnitTypeByNum(model.getWyFirstCircle()));
         return  str;
     }
     private String getbackRentRemarkByParam(YwContract model) {
@@ -649,15 +648,12 @@
         }
         int num =1;
         for(int i=0;i<billList1.size();i++){
-            if(Constants.equalsInteger( billList1.get(i).getCostType(),Constants.ZERO)){
-                billList1.get(i).setSortnum(num++);
-            }
+            billList1.get(i).setSortnum(num);
+            num++;
         }
-          num =1;
         for(int i=0;i<billList2.size();i++){
-            if(Constants.equalsInteger( billList2.get(i).getCostType(),Constants.ONE)){
-                billList2.get(i).setSortnum(num++);
-            }
+            billList2.get(i).setSortnum(num);
+            num++;
         }
         if(model.getId()!=null){
             ywContractBillMapper.insert(billList1);
@@ -801,7 +797,7 @@
     }
     private BigDecimal getTotalFeeByStartEnd(YwContract model, YwContractDetail d, YwContractBill bill,Date freeStart,Date freeEnd) {
         BigDecimal totalFee = new BigDecimal(0);
-        DateCompare dateCompare =   DateCompare.dayCompare(bill.getStartDate(),DateUtil.addDaysToDate(bill.getEndDate(),1),freeStart,DateUtil.addDaysToDate(freeEnd,1));
+        DateCompare dateCompare =   DateCompare.dayCompare(bill.getStartDate(),bill.getEndDate(),freeStart, freeEnd);
         if(Constants.equalsInteger(d.getCircleType(),Constants.ZERO)){
             //0=鍏冩瘡骞崇背澶�
             int days = dateCompare.getDay() ;
@@ -1232,47 +1228,53 @@
                             ,Constants.YwLogType.CONTRACT_UPDATE.getKey())
                     .orderByAsc(YwWorkorderLog::getCreateDate)));
 
-            //鏌ヨ璐﹀崟闆嗗悎
-            model.setBillList(ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
-                            .selectAll(YwContractBill.class )
-                            .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE  else  -yw.ACT_RECEIVABLE_FEE end),0) from  yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as  actReceivableFee  ")
-                            .eq(  YwContractBill::getContractId,model.getId())
-                            .eq(YwContractBill::getIsdeleted,Constants.ZERO)
-                            .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate)));
+            queryBillListByModel(model,new Date());
+        }
+        return model;
+    }
+    @Override
+    public YwContract findForBills(YwContract model) {
+        queryBillListByModel(model,model.getBtDate());
+        return model;
 
-            for (YwContractBill ywContractBill:model.getBillList()) {
-                ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
-            }
+    }
+    private void queryBillListByModel(YwContract model,Date date) {
+        //鏌ヨ璐﹀崟闆嗗悎
+        model.setBillList(ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
+                .selectAll(YwContractBill.class )
+                .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE  else  -yw.ACT_RECEIVABLE_FEE end),0) from  yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as  actReceivableFee  ")
+                .eq(  YwContractBill::getContractId,model.getId())
+                .eq(YwContractBill::getIsdeleted,Constants.ZERO)
+                .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate)));
 
-            model.setCanBackRentBills(new ArrayList<>());
-            long nowStart = Utils.Date.getStart(new Date()).getTime();
-            long nowEnd = Utils.Date.getEnd(new Date()).getTime();
-            if(model.getBillList()!=null && model.getBillList().size()>0){
-                for(YwContractBill bill: model.getBillList()){
-                    //浠樻鐘舵�侊細0=寰呮敹娆撅紱1=宸茬粨娓咃紱2=閮ㄥ垎缁撴竻锛�3=寰呬粯娆撅紱4=寰呴��娆撅紱5=宸插叧闂�
-                    if(Constants.equalsInteger(bill.getPayStatus(),Constants.ZERO)
-                            ||Constants.equalsInteger(bill.getPayStatus(),Constants.THREE)){
-                        if(bill.getStartDate().getTime()>nowEnd){
-                            //濡傛灉杩樻病寮�濮嬶紝璐﹀崟鐩存帴鍏抽棴
-                            continue;
-                        }
-                        model.getCanBackRentBills().add(bill);
-
-                    }else  if(Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){
-                        if(bill.getEndDate().getTime()<nowStart){
-                            //濡傛灉宸茬粨娓咃紝璐﹀崟鐩存帴鍏抽棴
-                            continue;
-                        }
-                        model.getCanBackRentBills().add(bill);
-                    }else  if(Constants.equalsInteger(bill.getPayStatus(),Constants.TWO) ){
-                        model.getCanBackRentBills().add(bill);
+        for (YwContractBill ywContractBill:model.getBillList()) {
+            ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
+        }
+        model.setCanBackRentBills(new ArrayList<>());
+        long nowStart = Utils.Date.getStart(date).getTime();
+        long nowEnd = Utils.Date.getEnd(date).getTime();
+        if(model.getBillList()!=null && model.getBillList().size()>0){
+            for(YwContractBill bill: model.getBillList()){
+                //浠樻鐘舵�侊細0=寰呮敹娆撅紱1=宸茬粨娓咃紱2=閮ㄥ垎缁撴竻锛�3=寰呬粯娆撅紱4=寰呴��娆撅紱5=宸插叧闂�
+                if(Constants.equalsInteger(bill.getPayStatus(),Constants.ZERO)
+                        ||Constants.equalsInteger(bill.getPayStatus(),Constants.THREE)){
+                    if(bill.getStartDate().getTime()>nowEnd){
+                        //濡傛灉杩樻病寮�濮嬶紝璐﹀崟鐩存帴鍏抽棴
+                        continue;
                     }
+                    model.getCanBackRentBills().add(bill);
+
+                }else  if(Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){
+                    if(bill.getEndDate().getTime()<nowStart){
+                        //濡傛灉宸茬粨娓咃紝璐﹀崟鐩存帴鍏抽棴
+                        continue;
+                    }
+                    model.getCanBackRentBills().add(bill);
+                }else  if(Constants.equalsInteger(bill.getPayStatus(),Constants.TWO) ){
+                    model.getCanBackRentBills().add(bill);
                 }
             }
-
         }
-
-        return model;
     }
 
     @Override

--
Gitblit v1.9.3