|  |  | 
 |  |  |                         .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when  t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE  when t.bill_type = 1 and 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::getId,YwContractBill::getCompanyId) | 
 |  |  |                         .selectAs(Company::getName,YwContractBill::getCompanyName) | 
 |  |  |                         .selectAs(SystemUser::getRealname,YwContractBill::getRealname) | 
 |  |  |                         .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId) | 
 |  |  | 
 |  |  |         ); | 
 |  |  |  | 
 |  |  |         //房源数据 | 
 |  |  |         ywContractBill.setYwContractRoomList(ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>() | 
 |  |  |         ywContractBill.setYwContractRoomList( | 
 |  |  |                 ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>() | 
 |  |  |                 .selectAll(YwContractRoom.class) | 
 |  |  |                 .selectAs(YwProject::getName,YwRoom::getProjectName) | 
 |  |  |                 .selectAs(YwFloor::getName,YwRoom::getFloorName) | 
 |  |  | 
 |  |  |                 .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) | 
 |  |  |                 .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) | 
 |  |  |                 .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO) || Constants.equalsInteger(ywContractBill.getType(),Constants.TWO),YwContractRoom::getContractId,ywContractBill.getContractId()) | 
 |  |  |                 .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO)| Constants.equalsInteger(ywContractBill.getType(),Constants.TWO),YwContractRoom::getType,Constants.ZERO) | 
 |  |  |         )); | 
 |  |  |  | 
 |  |  |         //收支记录 | 
 |  |  | 
 |  |  |                 for (YwContractBill ywContractBill:ywContractBillList) { | 
 |  |  |                     if(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO)){ | 
 |  |  |                         ywContractBill.setYwContractRoomList( | 
 |  |  |                                 ywContractRoomList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)&&Constants.equalsInteger(i.getContractId(),ywContractBill.getContractId())).collect(Collectors.toList()) | 
 |  |  |                                 ywContractRoomList.stream().filter(i->(Constants.equalsInteger(i.getType(),Constants.TWO)||Constants.equalsInteger(i.getType(),Constants.ZERO))&&Constants.equalsInteger(i.getContractId(),ywContractBill.getContractId())).collect(Collectors.toList()) | 
 |  |  |                         ); | 
 |  |  |                     }else{ | 
 |  |  |                         ywContractBill.setYwContractRoomList( | 
 |  |  | 
 |  |  |                 for (String codeDate:codeDateSet) { | 
 |  |  |                     //获取当前日期的数据 | 
 |  |  |                     List<YwContractBill> codeDateBillList = | 
 |  |  |                             ywContractBillList.stream().filter(i->i.getCodeDate().equals(codeDate)).collect(Collectors.toList()); | 
 |  |  |                             ywContractBillList.stream().filter(i->StringUtils.isNotBlank(i.getCodeDate()) && i.getCodeDate().equals(codeDate)).collect(Collectors.toList()); | 
 |  |  |                     if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(codeDateBillList)){ | 
 |  |  |                         continue; | 
 |  |  |                     } |