| | |
| | | } |
| | | |
| | | private void dealRoomsForContract(YwContract model) { |
| | | this.dealRoomsValid(model); |
| | | List<YwContractRoom> list = new ArrayList<>(); |
| | | for(YwRoom room :model.getRoomList()){ |
| | | YwContractRoom t = new YwContractRoom(); |
| | |
| | | } |
| | | ywContractRoomMapper.insert(list); |
| | | } |
| | | |
| | | private void dealRoomsValid(YwContract model){ |
| | | List<Integer> roomIds = model.getRoomList().stream().map(i->i.getId()).collect(Collectors.toList()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(roomIds)){ |
| | | if(ywContractMapper.selectJoinCount(new MPJLambdaWrapper<YwContract>() |
| | | .leftJoin(YwContractRoom.class,YwContractRoom::getContractId,YwContract::getId) |
| | | .eq(YwContractRoom::getType,Constants.ZERO) |
| | | .in(YwContractRoom::getRoomId,roomIds) |
| | | .in(YwContract::getStatus,Constants.ZERO,Constants.ONE,Constants.TWO) |
| | | .apply(" (" + |
| | | " ( t.START_DATE < '"+DateUtil.getFomartDate(model.getEndDate(),"yyyy-MM-dd HH:mm:ss")+"' and t.END_DATE > '"+DateUtil.getFomartDate(model.getStartDate(),"yyyy-MM-dd HH:mm:ss")+"' ) " + |
| | | "or " + |
| | | " ( t.START_DATE < '"+DateUtil.getFomartDate(model.getEndDate(),"yyyy-MM-dd HH:mm:ss")+"' and t.END_DATE > '"+DateUtil.getFomartDate(model.getStartDate(),"yyyy-MM-dd HH:mm:ss")+"' ) " + |
| | | " ) ") |
| | | |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"房源已被占用请刷新重试"); |
| | | }; |
| | | |
| | | if(ywContractMapper.selectJoinCount(new MPJLambdaWrapper<YwContract>() |
| | | .leftJoin(YwContractRoom.class,YwContractRoom::getContractId,YwContract::getId) |
| | | .eq(YwContractRoom::getType,Constants.ZERO) |
| | | .in(YwContractRoom::getRoomId,roomIds) |
| | | .in(YwContract::getStatus,Constants.THREE) |
| | | .apply(" ( t.START_DATE < '"+DateUtil.getFomartDate(model.getEndDate(),"yyyy-MM-dd HH:mm:ss")+"' " + |
| | | " and t.BT_DATE > '"+DateUtil.getFomartDate(model.getStartDate(),"yyyy-MM-dd HH:mm:ss")+"' ) " ) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"房源已被占用请刷新重试"); |
| | | }; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<YwContractBill> getBillList(YwContract model){ |
| | |
| | | ,Constants.YwLogType.CONTRACT_UPDATE.getKey()) |
| | | .orderByAsc(YwWorkorderLog::getCreateDate))); |
| | | |
| | | //查询账单集合 |
| | | |
| | | queryBillListByModel(model,new Date()); |
| | | } |
| | | return model; |
| | |
| | | //查询账单集合 |
| | | model.setBillList(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 ") |
| | | //.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 ") |
| | | .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 ") |
| | | .eq( YwContractBill::getContractId,model.getId()) |
| | | .eq(YwContractBill::getIsdeleted,Constants.ZERO) |
| | | .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate))); |