From a5f40b4c2590a3d61592f1918d689d4932545248 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 22 一月 2025 15:06:38 +0800
Subject: [PATCH] ll
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProjectServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProjectServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProjectServiceImpl.java
index b5dfdb8..81b1493 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProjectServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProjectServiceImpl.java
@@ -6,11 +6,13 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.YwBuildingMapper;
import com.doumee.dao.business.YwFloorMapper;
import com.doumee.dao.business.YwProjectMapper;
import com.doumee.dao.business.YwRoomMapper;
+import com.doumee.dao.business.dto.DataDTO;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.CompanyTree;
import com.doumee.dao.business.vo.ProjectDataVO;
@@ -28,6 +30,7 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -137,7 +140,21 @@
@Override
public YwProject findById(Integer id) {
- return ywProjectMapper.selectById(id);
+ YwProject ywProject = ywProjectMapper.selectById(id);
+ if(Objects.isNull(ywProject)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(Objects.nonNull(ywProject.getAreaId())){
+ Areas a = areasService.findById(ywProject.getAreaId(),Constants.TWO);
+ if(a != null){
+ ywProject.setAreaName(a.getName());
+ ywProject.setCityId(a.getCityId());
+ ywProject.setCityName(a.getCityName());
+ ywProject.setProvinceId(a.getProvinceId());
+ ywProject.setProvinceName(a.getProvinceName());
+ }
+ }
+ return ywProject;
}
@Override
@@ -230,11 +247,12 @@
@Override
- public List<ProjectDataVO> projectTree(){
+ public List<ProjectDataVO> projectTree(DataDTO dataDTO){
List<ProjectDataVO> projectDataVOList = new ArrayList<>();
List<YwProject> ywProjectList = ywProjectMapper.selectList(new QueryWrapper<YwProject>().lambda()
.eq(YwProject::getIsdeleted,Constants.ZERO)
.eq(YwProject::getStatus,Constants.ZERO)
+ .eq(Objects.nonNull(dataDTO.getProjectId()),YwProject::getId,dataDTO.getProjectId())
.orderByAsc(YwProject::getSortnum)
);
for (YwProject ywProject:ywProjectList) {
@@ -247,6 +265,7 @@
List<YwBuilding> ywBuildingList = ywBuildingMapper.selectList(new QueryWrapper<YwBuilding>().lambda()
.eq(YwBuilding::getIsdeleted,Constants.ZERO)
.eq(YwBuilding::getStatus,Constants.ZERO)
+ .eq(Objects.nonNull(dataDTO.getProjectId()),YwBuilding::getProjectId,dataDTO.getProjectId())
.orderByAsc(YwBuilding::getSortnum)
);
@@ -262,6 +281,7 @@
List<YwFloor> ywFloorList = ywFloorMapper.selectList(new QueryWrapper<YwFloor>().lambda()
.eq(YwFloor::getIsdeleted,Constants.ZERO)
.eq(YwFloor::getStatus,Constants.ZERO)
+ .eq(Objects.nonNull(dataDTO.getProjectId()),YwFloor::getProjectId,dataDTO.getProjectId())
.orderByAsc(YwFloor::getSortnum)
);
@@ -273,19 +293,27 @@
projectDataVOList.add(projectDataVO);
}
-
-
List<YwRoom> ywRoomList = ywRoomMapper.selectList(new QueryWrapper<YwRoom>().lambda()
.eq(YwRoom::getIsdeleted,Constants.ZERO)
.eq(YwRoom::getStatus,Constants.ZERO)
- .orderByAsc(YwRoom::getSortnum)
+ .eq(YwRoom::getIsInvestment,Constants.ONE)
+ .eq(Objects.nonNull(dataDTO.getProjectId()),YwRoom::getProjectId,dataDTO.getProjectId())
+ .apply(Objects.nonNull(dataDTO)&&Objects.nonNull(dataDTO.getStartDate())&&Objects.nonNull(dataDTO.getEndDate())," id not in (" +
+ " SELECT y2.room_id FROM yw_contract y1 left join yw_contract_room y2 on y1.id = y2.contract_id where 1 = 1 and y1.`STATUS` in( 0,1,2) " +
+ " and y1.START_DATE < '"+dataDTO.getEndDate()+" 00:00:00' and y1.END_DATE > '"+ dataDTO.getStartDate() +" 00:00:00' " +
+ " ) ")
+ .apply(Objects.nonNull(dataDTO)&&Objects.nonNull(dataDTO.getStartDate())&&Objects.nonNull(dataDTO.getEndDate())," id not in (" +
+ " SELECT y2.room_id FROM yw_contract y1 left join yw_contract_room y2 on y1.id = y2.contract_id where 1 = 1 and y1.`STATUS` = 3 " +
+ " and y1.START_DATE < '"+dataDTO.getEndDate()+" 00:00:00' and y1.BT_DATE > '"+ dataDTO.getStartDate() +" 00:00:00' " +
+ " ) ")
+ .orderByAsc(YwRoom::getRoomNum)
);
-
for (YwRoom data:ywRoomList) {
ProjectDataVO projectDataVO = new ProjectDataVO();
BeanUtils.copyProperties(data,projectDataVO);
- projectDataVO.setName(data.getCode());
+ projectDataVO.setName(data.getRoomNum());
+ projectDataVO.setArea(data.getRentArea().setScale(2, BigDecimal.ROUND_HALF_UP));
projectDataVO.setPId(data.getFloor());
projectDataVO.setLv(Constants.THREE);
projectDataVOList.add(projectDataVO);
@@ -294,7 +322,6 @@
ProjectTree treeBuild = new ProjectTree(projectDataVOList);
projectDataVOList = treeBuild.buildTree();
return projectDataVOList;
-
}
--
Gitblit v1.9.3