From d3830805113d4303dcc5aaad671b5167e9b2e188 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期日, 01 十二月 2024 22:26:44 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/funingyunwei
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java | 66 +++++++++++++++++++--------------
1 files changed, 38 insertions(+), 28 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 4c5bb96..4795aa6 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
@@ -33,6 +33,7 @@
import java.math.BigDecimal;
import java.time.temporal.ChronoUnit;
import java.util.*;
+import java.util.stream.Collectors;
/**
* 杩愮淮鍚堝悓淇℃伅琛⊿ervice瀹炵幇
@@ -311,6 +312,9 @@
update.setBtFee(param.getBtFee());
update.setBtRemark(getbackRentRemarkByParam(param));
ywContractMapper.updateById(update);
+// if(1==1){
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED);
+// }
dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param));
return param.getId();
}
@@ -348,7 +352,7 @@
List<YwContractBill> canBills = new ArrayList<>();//鍙��绉熶慨鏀规暟鎹�
List<YwContractBill> allBills = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>().
select("*," +
- "( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = yw_contract_bill.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee " )
+ "( 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 = yw_contract_bill.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee " )
.lambda().
eq(YwContractBill::getIsdeleted,Constants.ZERO)
.eq(YwContractBill::getContractId,param.getId()));
@@ -365,15 +369,23 @@
}
if(Constants.equalsInteger(bill.getPayStatus(),Constants.ZERO)
||Constants.equalsInteger(bill.getPayStatus(),Constants.THREE)){
- if(bill.getStartDate().getTime()>param.getEditDate().getTime()){
+ if(bill.getStartDate().getTime()<param.getBtDate().getTime()){
+ canBills.add(bill);
+ }else{
//濡傛灉杩樻病寮�濮嬶紝璐﹀崟鐩存帴鍏抽棴
closeBills.add(bill);
noBills.add(bill);
- }else{
- canBills.add(bill);
}
+// if(bill.getStartDate().getTime()>param.getEditDate().getTime()){
+// //濡傛灉杩樻病寮�濮嬶紝璐﹀崟鐩存帴鍏抽棴
+// closeBills.add(bill);
+// noBills.add(bill);
+// }else{
+// canBills.add(bill);
+// }
}else if(Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){
- if(bill.getEndDate().getTime()<param.getEditDate().getTime()){
+ if(bill.getStartDate().getTime()>param.getBtDate().getTime()){
+// if(bill.getEndDate().getTime()<param.getEditDate().getTime()){
//濡傛灉宸茬粨娓咃紝璐﹀崟鐩存帴鍏抽棴
noBills.add(bill);
}else{
@@ -415,6 +427,7 @@
//濡傛灉璐﹀崟杩樻湁娆惧緟鏀讹紝鍒欎繚鎸佺姸鎬佷笉鍙�
}
}
+ b.setReceivableFee(editBill.getReceivableFee());
b.setEditDate(param.getEditDate());
b.setEditor(param.getEditor());
b.setBtActDate(param.getBtActDate());
@@ -467,26 +480,21 @@
if(yjBills.size()>0){
// 濡傛灉鏄娂閲戞垨鑰呬繚璇侀噾锛屼笉鏀寔閫�娆撅紝淇濇寔鍘熸潵鐨勭姸鎬侊紝 0=绉熻祦璐癸紱1=鐗╀笟璐癸紱2=绉熻祦鎶奸噾锛�3=鐗╀笟鎶奸噾锛�4=姘寸數璐癸紱5=鏉傞」璐癸紱6=鍏朵粬;7=淇濊瘉閲�
for(YwContractBill bill : yjBills){
- if(!Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){
-// YwContractBill b = new YwContractBill();
-// //浠樻鐘舵�侊細0=寰呮敹娆撅紱1=宸茬粨娓咃紱2=閮ㄥ垎缁撴竻锛�3=寰呬粯娆撅紱4=寰呴��娆撅紱5=宸插叧闂�
-// //濡傛灉璐﹀崟淇℃伅鍋氫簡缂栬緫锛岄噾棰濊绠� 瀹炴敹閲戦 鍜� 淇敼鍚庡簲鏀堕噾棰濅綔瀵规瘮锛屽垽鏂槸鍚﹀簲璇ラ��娆�
-// BigDecimal fee = Constants.formatBigdecimal(bill.getActReceivableFee()).subtract(bill.getReceivableFee());
-// if(fee.compareTo(new BigDecimal(0))== 0){
-// //濡傛灉璐圭敤姝eソ锛屽垯淇敼璐﹀崟淇℃伅涓哄凡缁撴竻
-// b.setPayStatus(Constants.ONE);
-// }else if(fee.compareTo(new BigDecimal(0))> 0){
-// //濡傛灉闇�瑕佽繘琛岄��娆撅紝鏇存柊璐﹀崟淇℃伅涓哄緟閫�娆�
-// b.setPayStatus(Constants.FOUR);
-// }
-// b.setId(bill.getId());
-// b.setEditDate(param.getEditDate());
-// b.setEditor(param.getEditor());
-// b.setReceivableFee(BigDecimal.ZERO);
-// ywContractBillMapper.updateById(b);
- //濡傛灉鏄湭缁撴竻鎶奸噾
- yjNoBills ++;
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(param.getCanBackRentBills())){
+ List<YwContractBill> optional = param.getCanBackRentBills().stream().filter(i->Constants.equalsInteger(bill.getId(),i.getId())).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(optional)){
+ YwContractBill canBill = optional.get(Constants.ZERO);
+ YwContractBill yjBill = new YwContractBill();
+ yjBill.setId(bill.getId());
+ yjBill.setEditDate(param.getEditDate());
+ yjBill.setEditor(param.getEditor());
+ yjBill.setReceivableFee(BigDecimal.ZERO);
+ yjBill.setPayStatus(Constants.FOUR);
+ yjBill.setPlanPayDate(canBill.getPlanPayDate());
+ ywContractBillMapper.updateById(yjBill);
+ }
}
+ yjNoBills ++;
}
}
param.setBtWaitBill(canBills.size() + newBills.size()+yjNoBills);//鏈竻绠楃殑璐﹀崟鏁伴噺
@@ -787,14 +795,10 @@
bill.setTotleFee(totalFee);
bill.setReceivableFee(totalFee);
bill.setBillType(Constants.ZERO);
-
-
bill.setCompanyId(model.getCompanyId());
list.add(bill);
}
}
-
-
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));
@@ -1231,9 +1235,15 @@
//鏌ヨ璐﹀崟闆嗗悎
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)));
+
+ for (YwContractBill ywContractBill:model.getBillList()) {
+ ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
+ }
+
model.setCanBackRentBills(new ArrayList<>());
long nowStart = Utils.Date.getStart(new Date()).getTime();
long nowEnd = Utils.Date.getEnd(new Date()).getTime();
--
Gitblit v1.9.3