From 35ed9cd31d7b675082425361a9f08bec40aa1292 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 03 十二月 2024 18:23:01 +0800
Subject: [PATCH] ll
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java | 87 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 77 insertions(+), 10 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 34218a5..03953ce 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
@@ -66,7 +66,7 @@
|| Objects.isNull(ywContractBill.getBillType())
|| Objects.isNull(ywContractBill.getCompanyId())
|| com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywContractBill.getYwContractRoomList())
- || Objects.nonNull(ywContractBill.getFeeType())
+ || Objects.isNull(ywContractBill.getFeeType())
|| (Constants.equalsInteger(ywContractBill.getFeeType(),Constants.ZERO)&& (Objects.isNull(ywContractBill.getStartDate())
|| Objects.isNull(ywContractBill.getEndDate())))
){
@@ -87,6 +87,23 @@
ywContractBill.setIsdeleted(Constants.ZERO);
ywContractBill.setType(Constants.ONE);
ywContractBill.setStatus(Constants.ZERO);
+ if(Constants.equalsInteger(ywContractBill.getBillType(),Constants.ZERO)){
+ ywContractBill.setPayStatus(Constants.ZERO);
+ }else{
+ ywContractBill.setPayStatus(Constants.THREE);
+ }
+
+ if(Constants.equalsInteger(ywContractBill.getFeeType(),Constants.ONE)){
+ ywContractBill.setStartDate(ywContractBill.getPlanPayDate());
+ ywContractBill.setEndDate(ywContractBill.getPlanPayDate());
+ }
+ //鏌ヨ鍚堝悓涓嬬殑鏈�澶х殑搴忓彿
+ List<YwContractBill> ywContractBillList = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>().lambda().eq(YwContractBill::getContractId,ywContract.getId()).orderByDesc(YwContractBill::getId));
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBillList)){
+ ywContractBill.setSortnum(ywContractBillList.size() + 1 );
+ }else{
+ ywContractBill.setSortnum(Constants.ZERO);
+ }
ywContractBillMapper.insert(ywContractBill);
//鎴挎簮鏁版嵁
@@ -169,16 +186,23 @@
public YwContractBill getDetail(Integer id) {
YwContractBill ywContractBill = ywContractBillMapper.selectJoinOne(YwContractBill.class,
new MPJLambdaWrapper<YwContractBill>().selectAll(YwContractBill.class)
- .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .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 ")
.selectAs(YwContract::getCode,YwContractBill::getContractCode)
.selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .selectAs(Company::getName,YwContractBill::getCompanyName)
+ .selectAs(SystemUser::getRealname,YwContractBill::getRealname)
.leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
.leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .leftJoin(Company.class,Company::getId,YwContract::getCompanyId)
+ .leftJoin(SystemUser.class,SystemUser::getId,YwContractBill::getCreator)
.eq(YwContractBill::getIsdeleted,Constants.ZERO)
.eq(YwContractBill::getId,id));
if(Objects.isNull(ywContractBill)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
+ ywContractBill.setNeedReceivableFee(
+ ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
+ );
//鎴挎簮鏁版嵁
ywContractBill.setYwContractRoomList(ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
@@ -186,13 +210,30 @@
.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)
.leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId)
.leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
.leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
.leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId)
- .eq(YwContractRoom::getContractId,id)
- .eq(YwContractRoom::getType,Constants.ONE)
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE),YwContractRoom::getContractId,id)
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE),YwContractRoom::getType,Constants.ONE)
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO),YwContractRoom::getContractId,ywContractBill.getContractId())
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO),YwContractRoom::getType,Constants.ZERO)
));
+
+ //鏀舵敮璁板綍
+ ywContractBill.setYwContractRevenueList(
+ ywContractRevenueMapper.selectJoinList(YwContractRevenue.class,new MPJLambdaWrapper<YwContractRevenue>()
+ .selectAll(YwContractRevenue.class)
+ .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractRevenue::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .eq(YwContractRevenue::getStatus,Constants.ZERO)
+ .eq(YwContractRevenue::getBillId,ywContractBill.getId())
+ .orderByDesc(YwContractRevenue::getId)
+ )
+ );
//闄勪欢鏁版嵁
List<Multifile> multifileList = multifileMapper.selectJoinList(Multifile.class,new MPJLambdaWrapper<Multifile>()
@@ -235,7 +276,7 @@
YwContractBill model = pageWrap.getModel();
IPage<YwContractBill> iPage = ywContractBillMapper.selectJoinPage(page,YwContractBill.class,
queryWrapper.selectAll(YwContractBill.class)
- .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .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 ")
.selectAs(YwContract::getCode,YwContractBill::getContractCode)
.selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
.leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
@@ -245,12 +286,16 @@
YwCustomer::getName,model.getCustomerName())
.eq(Objects.nonNull(model)&&Objects.nonNull(model.getStatus()),
YwContractBill::getStatus,model.getStatus())
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getBillType()),
+ YwContractBill::getBillType,model.getBillType())
.eq(Objects.nonNull(model)&&Objects.nonNull(model.getPayStatus()),
YwContractBill::getPayStatus,model.getPayStatus())
.eq(Objects.nonNull(model)&&Objects.nonNull(model.getType()),
YwContractBill::getType,model.getType())
.eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()),
YwContractBill::getContractId,model.getContractId())
+ .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getContractCode()),
+ YwContract::getCode,model.getContractCode())
.ge(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateStart()),YwContractBill::getPlanPayDate, Utils.Date.getStart(model.getPlanPayDateStart()))
.le(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),YwContractBill::getPlanPayDate, Utils.Date.getEnd(model.getPlanPayDateEnd())) )
;
@@ -261,11 +306,12 @@
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))
- && ywContractBill.getEndDate().getTime() < System.currentTimeMillis()){
+ 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))
+ && ywContractBill.getPlanPayDate().getTime() < System.currentTimeMillis()){
ywContractBill.setIsOverdue(Constants.ONE);
}else{
ywContractBill.setIsOverdue(Constants.ZERO);
@@ -407,5 +453,26 @@
}
+ @Override
+ public List<YwContractBill> getCanBackBill(YwContractBill model) {
+ List<YwContractBill> list = 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 ")
+ .selectAs(YwContract::getCode,YwContractBill::getContractCode)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .eq(YwContractBill::getIsdeleted,Constants.ZERO)
+ .in(YwContractBill::getCostType,Constants.ZERO,Constants.ONE,Constants.FOUR,Constants.FIVE,7)
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()),
+ YwContractBill::getContractId,model.getContractId())
+ .le(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),YwContractBill::getStartDate, Utils.Date.getEnd(model.getPlanPayDateEnd())) )
+ ;
+
+ for (YwContractBill ywContractBill:list) {
+ ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
+ }
+ return list;
+ }
}
--
Gitblit v1.9.3