From abfb84c633a2bd1773cf9be27e753f787f1ed641 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 07 二月 2025 11:48:18 +0800
Subject: [PATCH] ll
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwRoomServiceImpl.java | 52 +++++++++++++++++++++++++++++++++++-----------------
1 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwRoomServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwRoomServiceImpl.java
index af4bcbc..b5c03ed 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwRoomServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwRoomServiceImpl.java
@@ -25,10 +25,7 @@
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -288,7 +285,7 @@
YwRoomStatusDataVO roomStatusDataVO = new YwRoomStatusDataVO();
roomStatusDataVO.setFloorId(ywRoom.getFloor());
roomStatusDataVO.setRoomId(ywRoom.getId());
- roomStatusDataVO.setRoomCode(ywRoom.getCode());
+ roomStatusDataVO.setRoomCode(ywRoom.getRoomNum());
roomStatusDataVO.setRoomRentArea(ywRoom.getRentArea());
List<YwContract> roomContractList = ywContractMapper.selectJoinList(YwContract.class,new MPJLambdaWrapper<YwContract>()
@@ -297,10 +294,10 @@
.leftJoin(YwContractRoom.class,YwContractRoom::getContractId,YwContract::getId)
.leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
.eq(YwContract::getIsdeleted,Constants.ZERO)
- .ge(YwContract::getStartDate, DateUtil.getCurrDateTime())
+ .le(YwContract::getStartDate, DateUtil.getCurrDateTime())
+ .ge(YwContract::getEndDate, DateUtil.getCurrDateTime())
.eq(YwContractRoom::getType,Constants.ZERO)
.eq(YwContractRoom::getRoomId,ywRoom.getId())
- .ne(YwContract::getBillStatus,Constants.THREE)
.orderByDesc(YwContract::getStartDate)
);
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(roomContractList)){
@@ -320,9 +317,24 @@
roomStatusDataVO.setOverData(ywContract.getBtDate());
}
}else{
- if(Objects.nonNull(ywContract.getEndDate()) && DateUtil.getBetweenDays(DateUtil.getFomartDate(ywContract.getEndDate(),"yyyy-MM-dd"),DateUtil.getFomartDate(new Date(),"yyyy-MM-dd"))<=90){
+ System.out.println(DateUtil.daysBetweenDates(ywContract.getEndDate(),new Date()));
+ if(Objects.nonNull(ywContract.getEndDate())
+ &&
+ DateUtil.daysBetweenDates(ywContract.getEndDate(),new Date())<=90){
roomStatusDataVO.setRoomStatus(Constants.TWO);
roomStatusDataVO.setOverData(ywContract.getEndDate());
+ }else{
+ roomStatusDataVO.setOverData(ywContract.getEndDate());
+ }
+ }
+ }else{
+ roomStatusDataVO.setRoomStatus(Constants.ZERO);
+ //宸查��绉� 璁$畻閫�绉熸椂闂�
+ if(Objects.nonNull(ywContract.getBtDate())){
+ //鏌ヨ閫�绉熸棩鏈熷拰褰撳墠鏃ユ湡鐩稿樊澶╂暟
+ Integer btDays = DateUtil.daysBetweenDates(new Date(),ywContract.getBtDate());
+ if(btDays>=Constants.ZERO){
+ roomStatusDataVO.setFreeDayAmount(btDays);
}
}
}
@@ -332,12 +344,15 @@
}
for (YwFloor ywFloor:ywFloorList) {
YwFloorStatusDataVO ywFloorStatusDataVO = new YwFloorStatusDataVO();
- ywFloorStatusDataVO.setFloor(ywFloor.getFloor());
+ ywFloorStatusDataVO.setFloorName(ywFloor.getName());
ywFloorStatusDataVO.setFloorId(ywFloor.getId());
- ywFloorStatusDataVO.setFloorArea(ywFloor.getArea());
+ ywFloorStatusDataVO.setFloorArea(BigDecimal.ZERO);
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(roomStatusDataList)){
List<YwRoomStatusDataVO> floorRoomList = roomStatusDataList.stream().filter(i->Objects.nonNull(i.getFloorId())&&Constants.equalsInteger(i.getFloorId(),ywFloor.getId())).collect(Collectors.toList());
ywFloorStatusDataVO.setYwRoomStatusDataVOList(floorRoomList);
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(floorRoomList)){
+ ywFloorStatusDataVO.setFloorArea(floorRoomList.stream().filter(i->Objects.nonNull(i.getRoomRentArea())).map(i->i.getRoomRentArea()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ }
}
ywFloorStatusDataVOList.add(ywFloorStatusDataVO);
}
@@ -358,6 +373,7 @@
ywRoomContractDataVO.setLeasePrice(BigDecimal.ZERO);
ywRoomContractDataVO.setLeaseArea(BigDecimal.ZERO);
ywRoomContractDataVO.setLeaseRoomAmount(Constants.ZERO);
+ ywRoomContractDataVO.setLeaseDayPrice(BigDecimal.ZERO);
List<YwRoom> ywRoomList = ywRoomMapper.selectList(new QueryWrapper<YwRoom>().lambda()
.eq(YwRoom::getIsdeleted,Constants.ZERO)
@@ -376,15 +392,13 @@
List<YwContract> roomContractList = ywContractMapper.selectJoinList(YwContract.class,new MPJLambdaWrapper<YwContract>()
.selectAll(YwContract.class)
.select(" ( select ifnull(sum(yr.RENT_AREA),0) from yw_contract_room y left join yw_room yr on y.room_id = yr.id where y.type = 0 and y.CONTRACT_ID = t.id ) " , YwContract::getTotalArea)
- .select(" ( select ifnull(sum(y.TOTLE_FEE),0) from yw_contract_bill y where y.CONTRACT_ID = t.id and y.type = 0 ) " , YwContract::getTotalFee)
+ .select(" ( select ifnull(sum(y.TOTLE_FEE),0) from yw_contract_bill y where y.CONTRACT_ID = t.id and y.type = 0 and y.COST_TYPE=0 and y.BILL_TYPE = 0 ) " , YwContract::getTotalFee)
.eq(YwContract::getIsdeleted,Constants.ZERO)
.in(YwContract::getStatus,Constants.ONE,Constants.TWO,Constants.THREE)
- .ne(YwContract::getBillStatus,Constants.THREE)
.apply(Objects.nonNull(model.getBuildingId()),
" t.id in ( select y.CONTRACT_ID from yw_contract_room y left join yw_room yr on y.room_id = yr.id where y.type = 0 and yr.BUILDING_ID = "+model.getBuildingId()+" ) ")
.apply(Objects.nonNull(model.getProjectId()),
" t.id in ( select y.CONTRACT_ID from yw_contract_room y left join yw_room yr on y.room_id = yr.id where y.type = 0 and yr.PROJECT_ID = "+model.getProjectId()+" ) ")
- .apply(Objects.nonNull(model.getProjectId())," ")
.orderByDesc(YwContract::getStartDate)
);
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(roomContractList)){
@@ -392,17 +406,21 @@
}
//澶勭悊绉熻祦鍗曚环 鏍规嵁 鍚堝悓绉熻祦鎬婚 / 锛堢璧佹椂闀� * 绉熻祦闈㈢Н锛�
for (YwContract ywContract:roomContractList) {
- long contractDayAmount = DateUtil.getBetweenDays(DateUtil.getFomartDate(ywContract.getEndDate(),"yyyy-MM-dd"),DateUtil.getFomartDate(ywContract.getStartDate(),"yyyy-MM-dd"));
+ long contractDayAmount = DateUtil.daysBetweenDates(ywContract.getEndDate()
+ ,ywContract.getStartDate());
if(Objects.nonNull(contractDayAmount) && Objects.nonNull(ywContract.getTotalArea()) && Objects.nonNull(ywContract.getTotalFee())){
- ywRoomContractDataVO.setLeasePrice(
- ywRoomContractDataVO.getLeasePrice().add(
+ ywRoomContractDataVO.setLeaseDayPrice(
+ ywRoomContractDataVO.getLeaseDayPrice().add(
ywContract.getTotalFee().divide((ywContract.getTotalArea().multiply(new BigDecimal(Long.toString(contractDayAmount)))),2,BigDecimal.ROUND_HALF_UP)
)
);
}
}
-
ywRoomContractDataVO.setLeaseContractAmount(roomContractList.size());
+ if(Objects.nonNull(ywRoomContractDataVO.getLeaseDayPrice())&&ywRoomContractDataVO.getLeaseDayPrice().compareTo(BigDecimal.ZERO)>Constants.ZERO){
+ ywRoomContractDataVO.setLeasePrice(
+ ywRoomContractDataVO.getLeaseDayPrice().divide(new BigDecimal(Integer.toString(ywRoomContractDataVO.getLeaseContractAmount())),2,BigDecimal.ROUND_HALF_UP));
+ }
List<Integer> contractId = roomContractList.stream().map(i->i.getId()).collect(Collectors.toList());
List<YwRoom> ywLeaseRoomList = ywRoomMapper.selectJoinList(YwRoom.class,new MPJLambdaWrapper<YwRoom>()
.selectAll(YwRoom.class)
--
Gitblit v1.9.3