|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | IPage<YwContractRevenue> iPage = ywContractRevenueMapper.selectJoinPage(page,YwContractRevenue.class, | 
|---|
|  |  |  | queryWrapper.selectAll(YwContractRevenue.class) | 
|---|
|  |  |  | .selectAs(YwContractBill::getCode,YwContractRevenue::getBillCode) | 
|---|
|  |  |  | .selectAs(YwContractBill::getType,YwContractRevenue::getBillType) | 
|---|
|  |  |  | .selectAs(YwContract::getCode,YwContractRevenue::getContractCode) | 
|---|
|  |  |  | .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName) | 
|---|
|  |  |  | .selectAs(SystemUser::getRealname,YwContractRevenue::getRealname) | 
|---|
|  |  |  | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){ | 
|---|
|  |  |  | StringBuilder roomPathName = new StringBuilder(); | 
|---|
|  |  |  | for (YwContractRoom ywContractRoom:ywContractRoomList) { | 
|---|
|  |  |  | if(Constants.equalsInteger(ywContractRevenue.getBillType(),Constants.ZERO)){ | 
|---|
|  |  |  | if(!(Constants.equalsInteger(ywContractRevenue.getContractId(),ywContractRoom.getContractId()) | 
|---|
|  |  |  | && Constants.equalsInteger(ywContractRoom.getType(),Constants.ZERO))){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | if(!(Constants.equalsInteger(ywContractRevenue.getBillId(),ywContractRoom.getContractId()) | 
|---|
|  |  |  | && Constants.equalsInteger(ywContractRoom.getType(),Constants.ONE))){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(ywContractRoom.getProjectName())){ | 
|---|
|  |  |  | roomPathName.append(ywContractRoom.getProjectName()+"/"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRevenueList)){ | 
|---|
|  |  |  | //获取所有数据 | 
|---|
|  |  |  | List<Integer> billIdList = ywContractRevenueList.stream().map(i->i.getBillId()).collect(Collectors.toList()); | 
|---|
|  |  |  | List<Integer> contractIdList = ywContractRevenueList.stream().map(i->i.getContractId()).collect(Collectors.toList()); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(billIdList)){ | 
|---|
|  |  |  | List<YwContractRoom> ywContractRoomList  = ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>() | 
|---|
|  |  |  | .selectAll(YwContractRoom.class) | 
|---|
|  |  |  | .selectAs(YwProject::getName,YwRoom::getProjectName) | 
|---|
|  |  |  | .selectAs(YwFloor::getName,YwRoom::getFloorName) | 
|---|
|  |  |  | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) | 
|---|
|  |  |  | .selectAs(YwRoom::getName,YwContractRoom::getRoomName) | 
|---|
|  |  |  | .selectAs(YwRoom::getCode,YwContractRoom::getRoomName) | 
|---|
|  |  |  | .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) | 
|---|
|  |  |  | .in(YwContractRoom::getContractId,billIdList) | 
|---|
|  |  |  | .eq(YwContractRoom::getType,Constants.ONE) | 
|---|
|  |  |  | .and(i->i.in(YwContractRoom::getContractId,billIdList).eq(YwContractRoom::getType,Constants.ONE) | 
|---|
|  |  |  | .or().in(YwContractRoom::getContractId,contractIdList).eq(YwContractRoom::getType,Constants.ZERO) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | //                        .in(YwContractRoom::getContractId,billIdList) | 
|---|
|  |  |  | //                        .eq(YwContractRoom::getType,Constants.ONE) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){ | 
|---|
|  |  |  | for (YwContractRevenue ywContractRevenue:ywContractRevenueList) { | 
|---|
|  |  |  | ywContractRevenue.setYwContractRoomList( | 
|---|
|  |  |  | ywContractRoomList.stream().filter(i->Constants.equalsInteger(i.getContractId(),ywContractRevenue.getBillId())).collect(Collectors.toList()) | 
|---|
|  |  |  | ywContractRoomList.stream().filter(i-> | 
|---|
|  |  |  | Constants.equalsInteger(i.getContractId(),ywContractRevenue.getBillId())||Constants.equalsInteger(i.getContractId(),ywContractRevenue.getContractId())) | 
|---|
|  |  |  | .collect(Collectors.toList()) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|