From 0a99001be87811ebb884b8f3f491f48054a22330 Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 13 五月 2025 17:29:00 +0800
Subject: [PATCH] 客户资料 巡检任务业务

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java |  161 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 92 insertions(+), 69 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
index 5d36fa2..e456e57 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
@@ -232,6 +232,17 @@
                 ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
         );
 
+        if(Constants.equalsInteger(ywContractBill.getStatus(),Constants.ZERO)
+                && (Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.ZERO)
+                || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.TWO)
+                || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.THREE)
+                || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.FOUR))
+                && Utils.Date.getEnd(ywContractBill.getPlanPayDate()).getTime() < System.currentTimeMillis()){
+            ywContractBill.setIsOverdue(Constants.ONE);
+        }else{
+            ywContractBill.setIsOverdue(Constants.ZERO);
+        }
+
         //鎴挎簮鏁版嵁
         ywContractBill.setYwContractRoomList(
                 ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
@@ -239,8 +250,8 @@
                 .selectAs(YwProject::getName,YwRoom::getProjectName)
                 .selectAs(YwFloor::getName,YwRoom::getFloorName)
                 .selectAs(YwBuilding::getName,YwRoom::getBuildingName)
-                .selectAs(YwRoom::getCode,YwContractRoom::getRoomName)
-                .selectAs(YwRoom::getArea,YwContractRoom::getArea)
+                .selectAs(YwRoom::getRoomNum,YwContractRoom::getRoomName)
+                .selectAs(YwRoom::getRentArea,YwContractRoom::getArea)
                 .leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId)
                 .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
                 .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
@@ -345,7 +356,7 @@
                 || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.TWO)
                 || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.THREE)
                 || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.FOUR))
-            && ywContractBill.getPlanPayDate().getTime() < System.currentTimeMillis()){
+            && Utils.Date.getEnd(ywContractBill.getPlanPayDate()).getTime() < System.currentTimeMillis()){
                 ywContractBill.setIsOverdue(Constants.ONE);
             }else{
                 ywContractBill.setIsOverdue(Constants.ZERO);
@@ -392,6 +403,8 @@
         IPage<YwContractBill> iPage = ywContractBillMapper.selectJoinPage(page,YwContractBill.class,
                 queryWrapper.selectAll(YwContractBill.class)
                         .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when  t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE  when t.bill_type = 1 and 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  ")
+                        .select(" ifnull((select s.status  from sms_email s where s.OBJ_ID = t.id and s.OBJ_TYPE = 2 order by s.CREATE_DATE desc  limit 1 ),0)  ",YwContractBill::getIsSendEmail)
+                        .select(" ifnull((select s.status  from sms_email s where s.OBJ_ID = t.id and s.OBJ_TYPE = 1 order by s.CREATE_DATE desc  limit 1 ),0)  ",YwContractBill::getIsSendSms)
                         .selectAs(YwContract::getCode,YwContractBill::getContractCode)
                         .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
                         .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
@@ -405,12 +418,12 @@
                                 YwContractBill::getBillType,model.getBillType())
                         .eq(Objects.nonNull(model)&&Objects.nonNull(model.getPayStatus()),
                                 YwContractBill::getPayStatus,model.getPayStatus())
-                        .in(Objects.nonNull(model)&&Objects.nonNull(model.getPayStatus()),
-                                YwContractBill::getPayStatus,Constants.ZERO,Constants.THREE,Constants.TWO,Constants.FOUR)
+                        .in(YwContractBill::getPayStatus,Constants.ZERO,Constants.TWO,Constants.THREE)
                         .eq(Objects.nonNull(model)&&Objects.nonNull(model.getType()),
                                 YwContractBill::getType,model.getType())
                         .le(Objects.nonNull(model)&&Objects.nonNull(model.getIsOverdue())&&Constants.equalsInteger(model.getIsOverdue(),Constants.ONE),
                                 YwContractBill::getPlanPayDate, DateUtil.getCurrDateTime())
+                        .lt(YwContractBill::getPlanPayDate, DateUtil.getDate(new Date(),"yyyy-MM-dd"))
                         .eq(Objects.nonNull(model)&&Objects.nonNull(model.getIsOverdue())&&Constants.equalsInteger(model.getIsOverdue(),Constants.ONE),
                                 YwContractBill::getStatus, Constants.ZERO)
                         .ge(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateStart()),YwContractBill::getPlanPayDate, Utils.Date.getStart(model.getPlanPayDateStart()))
@@ -455,7 +468,7 @@
         if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBillList)){
             //鑾峰彇鎵�鏈夋暟鎹�
             List<Integer> billIdList = ywContractBillList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).map(i->i.getId()).collect(Collectors.toList());
-            List<Integer> contractIdList = ywContractBillList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).map(i->i.getContractId()).collect(Collectors.toList());
+            List<Integer> contractIdList = ywContractBillList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)||Constants.equalsInteger(i.getType(),Constants.TWO)).map(i->i.getContractId()).collect(Collectors.toList());
             List<YwContractRoom> ywContractRoomList  = new ArrayList<>();
             if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(billIdList)){
                 ywContractRoomList.addAll( ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
@@ -463,7 +476,7 @@
                         .selectAs(YwProject::getName,YwRoom::getProjectName)
                         .selectAs(YwFloor::getName,YwRoom::getFloorName)
                         .selectAs(YwBuilding::getName,YwRoom::getBuildingName)
-                        .selectAs(YwRoom::getCode,YwContractRoom::getRoomName)
+                        .selectAs(YwRoom::getRoomNum,YwContractRoom::getRoomName)
                         .leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId)
                         .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
                         .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
@@ -479,7 +492,7 @@
                         .selectAs(YwProject::getName,YwRoom::getProjectName)
                         .selectAs(YwFloor::getName,YwRoom::getFloorName)
                         .selectAs(YwBuilding::getName,YwRoom::getBuildingName)
-                        .selectAs(YwRoom::getCode,YwContractRoom::getRoomName)
+                        .selectAs(YwRoom::getRoomNum,YwContractRoom::getRoomName)
                         .leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId)
                         .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
                         .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
@@ -690,7 +703,8 @@
                     .selectAs(YwContractDetail::getType,YwContractBill::getDetailType)
                     .selectAs(YwContract::getZlPayType,YwContractBill::getZlPayType)
                     .selectAs(YwContract::getWyPayType,YwContractBill::getWyPayType)
-                    .select(" ( select ifnull(sum(y.rent_area),0) from yw_room y left join yw_contract_room yr on y.id = yr.room_id where yr.contract_id = t.contract_id and y.IS_INVESTMENT = 0 and yr.type = 0 )  " , YwContractBill::getTotalArea)
+                    .select(" ( select ifnull(sum(y.rent_area),0) from yw_room y left join yw_contract_room yr on y.id = yr.room_id where yr.contract_id = t.contract_id and y.IS_INVESTMENT = 1 and yr.type = 0 )  " , YwContractBill::getTotalArea)
+                    .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when  t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE  when t.bill_type = 1 and 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  ")
                     .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
                     .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
                     .leftJoin(YwContractDetail.class,YwContractDetail::getId,YwContractBill::getDetailId)
@@ -825,7 +839,7 @@
             }else if(y.getTitle().equals("${搴旀敹鏃ユ湡}")&&Objects.nonNull(ywContractBill.getPlanPayDate())){
                 y.setUrl(DateUtil.formatDate(ywContractBill.getPlanPayDate(),"yyyy-MM-dd"));
             }else if(y.getTitle().equals("${搴旀敹閲戦}")&&Objects.nonNull(ywContractBill.getReceivableFee())){
-                y.setUrl(ywContractBill.getReceivableFee().toString());
+                y.setUrl((ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())).setScale(2).toString());
             }else if(y.getTitle().equals("${璐﹀崟澶囨敞}")){
                 if(StringUtils.isNotBlank(ywContractBill.getRemark())){
                     y.setUrl(ywContractBill.getRemark());
@@ -926,14 +940,19 @@
                     .selectAs(YwContractDetail::getType,YwContractBill::getDetailType)
                     .selectAs(YwContract::getZlPayType,YwContractBill::getZlPayType)
                     .selectAs(YwContract::getWyPayType,YwContractBill::getWyPayType)
-                    .select(" ( select ifnull(sum(r.rent_area),0) from yw_room y left join yw_contract_room yr on y.id = yr.room_id where yr.contract_id = t.contract_id and y.IS_INVESTMENT = 0 and yr.type = 0 )  " , YwContractBill::getTotalArea)
+                    .select(" ( select ifnull(sum(y.rent_area),0) from yw_room y left join yw_contract_room yr on y.id = yr.room_id where yr.contract_id = t.contract_id and y.IS_INVESTMENT = 1 and yr.type = 0 )  " , YwContractBill::getTotalArea)
                     .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
                     .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
                     .leftJoin(YwContractDetail.class,YwContractDetail::getId,YwContractBill::getDetailId)
                     .eq(YwContractBill::getId,ywSmsEmailBillCallDTO.getBillId())
                     .last( "limit 1" )
             );
-            this.dealTempData(tempList,ywContractBill,loginUserInfo);
+
+            List<YwContractBill> ywContractBillList = new ArrayList<>();
+            ywContractBillList.add(ywContractBill);
+            this.dealRoomDetail(ywContractBillList);
+
+//            this.dealTempData(tempList,ywContractBill,loginUserInfo);
             Member member = memberMapper.selectById(ywSmsEmailBillCallDTO.getUserId());
             if(Objects.isNull(member)){
                 throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀛樺湪鏈煡璇㈠埌鐨勪汉鍛樹俊鎭�");
@@ -947,11 +966,10 @@
                 if(Constants.equalsInteger(ywSmsEmailBillCallDTO.getSendEmail(),Constants.ONE) && StringUtils.isNotBlank(member.getEmail())
                         && emailTempConfigOptional.isPresent()){
                     String content = this.dealTempSmsEmailData(emailTempConfigOptional.get().getTitle(),tempList,ywContractBill,loginUserInfo);
-                    smsEmailService.sendEmail(content,member.getEmail(),ywContractBill.getId());
+                    smsEmailService.sendEmail(member.getEmail(),content,ywContractBill.getId());
                 }
             }
         }
-         
     }
 
 
@@ -963,82 +981,87 @@
         for (YwTempConfig y:ywTempConfigList) {
             if(y.getTitle().equals("${璐圭敤鍚嶇О}")&&Objects.nonNull(ywContractBill.getCostType())){
                 //璐圭敤绫诲瀷锛�0=绉熻祦璐癸紱1=鐗╀笟璐癸紱2=绉熻祦鎶奸噾锛�3=鐗╀笟鎶奸噾锛�4=姘寸數璐癸紱5=鏉傞」璐癸紱6=鍏朵粬; 7=淇濊瘉閲�
-                if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ZERO)){ 
-                    tempStr.replace("${璐圭敤鍚嶇О}","绉熻祦璐�");
+                if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ZERO)){
+                    tempStr = tempStr.replace("${璐圭敤鍚嶇О}","绉熻祦璐�");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ONE)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","鐗╀笟璐�");
+                    tempStr = tempStr.replace("${璐圭敤鍚嶇О}","鐗╀笟璐�");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.TWO)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","绉熻祦鎶奸噾");
+                    tempStr = tempStr.replace("${璐圭敤鍚嶇О}","绉熻祦鎶奸噾");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.THREE)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","鐗╀笟鎶奸噾");
+                  tempStr =   tempStr.replace("${璐圭敤鍚嶇О}","鐗╀笟鎶奸噾");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.FOUR)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","姘寸數璐�");
+                  tempStr =   tempStr.replace("${璐圭敤鍚嶇О}","姘寸數璐�");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.FIVE)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","鏉傞」璐�");
+                  tempStr =   tempStr.replace("${璐圭敤鍚嶇О}","鏉傞」璐�");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.SIX)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","鍏朵粬");
+                  tempStr =   tempStr.replace("${璐圭敤鍚嶇О}","鍏朵粬");
                 }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.SEVEN)){
-                    tempStr.replace("${璐圭敤鍚嶇О}","淇濊瘉閲�");
+                  tempStr =   tempStr.replace("${璐圭敤鍚嶇О}","淇濊瘉閲�");
                 }
-            }else if(y.getTitle().equals("${璁¤垂鍛ㄦ湡}")&&Objects.nonNull(ywContractBill.getDetailType())){
-                if(Constants.equalsInteger(ywContractBill.getDetailType(),Constants.ZERO)){
-                    //绉熻祦鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
-                    if(Objects.nonNull(ywContractBill.getZlPayType())){
-                        if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ZERO)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�娆℃�т粯娆�");
-                        }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ONE)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","姣忎笁涓湀涓�浠�");
-                        }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.TWO)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","鍏釜鏈堜竴浠�");
-                        }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.THREE)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�骞翠竴浠�");
+            }else if(y.getTitle().equals("${璁¤垂鍛ㄦ湡}")){
+                if(Objects.nonNull(ywContractBill.getDetailType())){
+                    if(Constants.equalsInteger(ywContractBill.getDetailType(),Constants.ZERO)){
+                        //绉熻祦鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
+                        if(Objects.nonNull(ywContractBill.getZlPayType())){
+                            if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ZERO)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�娆℃�т粯娆�");
+                            }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ONE)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","姣忎笁涓湀涓�浠�");
+                            }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.TWO)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","鍏釜鏈堜竴浠�");
+                            }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.THREE)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�骞翠竴浠�");
+                            }
+                        }
+                    }else{
+                        //鐗╀笟鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
+                        if(Objects.nonNull(ywContractBill.getWyPayType())){
+                            if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ZERO)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�娆℃�т粯娆�");
+                            }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ONE)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","姣忎笁涓湀涓�浠�");
+                            }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.TWO)){
+                                tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","鍏釜鏈堜竴浠�");
+                            }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.THREE)){
+                                tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�骞翠竴浠�");
+                            }
                         }
                     }
                 }else{
-                    //鐗╀笟鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
-                    if(Objects.nonNull(ywContractBill.getWyPayType())){
-                        if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ZERO)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�娆℃�т粯娆�");
-                        }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ONE)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","姣忎笁涓湀涓�浠�");
-                        }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.TWO)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","鍏釜鏈堜竴浠�");
-                        }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.THREE)){
-                            tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�骞翠竴浠�");
-                        }
-                    }
+                    tempStr = tempStr.replace("${璁¤垂鍛ㄦ湡}","");
                 }
+
             }else if(y.getTitle().equals("${鍗曚环}")&&Objects.nonNull(ywContractBill.getPrice())){
-                tempStr.replace("${鍗曚环}",ywContractBill.getPrice().toString());
+                tempStr = tempStr.replace("${鍗曚环}",ywContractBill.getPrice().setScale(2).toString());
             }else if(y.getTitle().equals("${鍗曚綅}")&&Objects.nonNull(ywContractBill.getCircleType())){
                 //浠樻鍛ㄦ湡绫诲瀷 0=鍏冩瘡骞崇背澶�;1=鍏冩瘡骞崇背鏈�;2=鍏冩瘡骞崇背骞�;3=鍏冩瘡澶�;4=鍏冩瘡鏈�;5=鍏冩瘡骞�;6=鍏冩瘡鍦�;
                 if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.ZERO)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背澶�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背澶�");
                 }else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.ONE)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背鏈�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背鏈�");
                 }else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.TWO)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背骞�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背骞�");
                 } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.THREE)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡澶�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡澶�");
                 } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.FOUR)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡鏈�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡鏈�");
                 } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.FIVE)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡骞�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡骞�");
                 } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.SIX)){
-                    tempStr.replace("${鍗曚綅}","鍏冩瘡鍦�");
+                  tempStr =   tempStr.replace("${鍗曚綅}","鍏冩瘡鍦�");
                 }
             }else if(y.getTitle().equals("${搴旀敹鏃ユ湡}")&&Objects.nonNull(ywContractBill.getPlanPayDate())){
-                tempStr.replace("${搴旀敹鏃ユ湡}",DateUtil.formatDate(ywContractBill.getPlanPayDate(),"yyyy-MM-dd"));
+                tempStr = tempStr.replace("${搴旀敹鏃ユ湡}",DateUtil.formatDate(ywContractBill.getPlanPayDate(),"yyyy-MM-dd"));
             }else if(y.getTitle().equals("${搴旀敹閲戦}")&&Objects.nonNull(ywContractBill.getReceivableFee())){
-                tempStr.replace("${搴旀敹閲戦}",ywContractBill.getReceivableFee().toString());
+                tempStr = tempStr.replace("${搴旀敹閲戦}",(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())).setScale(2).toString());
             }else if(y.getTitle().equals("${璐﹀崟澶囨敞}")){
                 if(StringUtils.isNotBlank(ywContractBill.getRemark())){
-                    tempStr.replace("${璐﹀崟澶囨敞}",ywContractBill.getRemark());
+                  tempStr =   tempStr.replace("${璐﹀崟澶囨敞}",ywContractBill.getRemark());
                 }else{
-                    tempStr.replace("${璐﹀崟澶囨敞}","");
+                  tempStr =   tempStr.replace("${璐﹀崟澶囨敞}","");
                 }
             }else if(y.getTitle().equals("${绉熷鍚嶇О}")&&StringUtils.isNotBlank(ywContractBill.getCustomerName())){
-                tempStr.replace("${绉熷鍚嶇О}",ywContractBill.getCustomerName());
+                tempStr = tempStr.replace("${绉熷鍚嶇О}",ywContractBill.getCustomerName());
             }else if(y.getTitle().equals("${鎴块棿淇℃伅}")){
                 if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBill.getYwContractRoomList())){
                     StringBuilder roomPathName = new StringBuilder();
@@ -1059,32 +1082,32 @@
                             roomPathName.append(";");
                         }
                     }
-                    tempStr.replace("${鎴块棿淇℃伅}",roomPathName.toString());
+                    tempStr = tempStr.replace("${鎴块棿淇℃伅}",roomPathName.toString());
                 }
             }else if(y.getTitle().equals("${绉熻祦闈㈢Н}")&&Objects.nonNull(ywContractBill.getTotalArea())){
                 tempStr.replace("${绉熻祦闈㈢Н}",ywContractBill.getTotalArea().toString());
             }else if(y.getTitle().equals("${鎵�灞炲叕鍙歌处鎴峰悕绉皚")){
                 if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getName())){
-                    tempStr.replace("${鎵�灞炲叕鍙歌处鎴峰悕绉皚",ywAccount.getName());
+                  tempStr =   tempStr.replace("${鎵�灞炲叕鍙歌处鎴峰悕绉皚",ywAccount.getName());
                 }else{
-                    tempStr.replace("${鎵�灞炲叕鍙歌处鎴峰悕绉皚","-");
+                  tempStr =   tempStr.replace("${鎵�灞炲叕鍙歌处鎴峰悕绉皚","-");
                 }
             }else if(y.getTitle().equals("${鎵�灞炲叕鍙搁摱琛岃处鍙穧")){ 
                 if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getName())){
-                    tempStr.replace("${鎵�灞炲叕鍙搁摱琛岃处鍙穧",ywAccount.getName());
+                  tempStr =   tempStr.replace("${鎵�灞炲叕鍙搁摱琛岃处鍙穧",ywAccount.getName());
                 }else{
-                    tempStr.replace("${鎵�灞炲叕鍙搁摱琛岃处鍙穧","-");
+                  tempStr =   tempStr.replace("${鎵�灞炲叕鍙搁摱琛岃处鍙穧","-");
                 }
             }else if(y.getTitle().equals("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎")){
                 if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getBankNo())){
-                    tempStr.replace("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎",ywAccount.getBankNo());
+                  tempStr =   tempStr.replace("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎",ywAccount.getBankNo());
                 }else{
-                    tempStr.replace("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎","-");
+                  tempStr =   tempStr.replace("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎","-");
                 }
             }else if(y.getTitle().equals("${閫氱煡鍗曠敓鎴愭棩鏈焳")){
-                tempStr.replace("${閫氱煡鍗曠敓鎴愭棩鏈焳",DateUtil.formatDate(new Date(),"yyyy-MM-dd"));
+                tempStr = tempStr.replace("${閫氱煡鍗曠敓鎴愭棩鏈焳",DateUtil.formatDate(new Date(),"yyyy-MM-dd"));
             }else if(y.getTitle().equals("${鍒惰〃浜哄悕绉皚")){
-                tempStr.replace("${鍒惰〃浜哄悕绉皚",loginUserInfo.getRealname());
+                tempStr = tempStr.replace("${鍒惰〃浜哄悕绉皚",loginUserInfo.getRealname());
             } 
         }
         return tempStr;

--
Gitblit v1.9.3