| | |
| | | } |
| | | |
| | | 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.getBtDate(),"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(),"房源已被占用请刷新重试"); |
| | | }; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<YwContractBill> getBillList(YwContract model){ |
| | |
| | | update.setBtFee(param.getBtFee()); |
| | | update.setBtRemark(getbackRentRemarkByParam(param)); |
| | | ywContractMapper.updateById(update); |
| | | // if(1==1){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | // } |
| | | dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param)); |
| | | return param.getId(); |
| | | } |
| | |
| | | totalBackFee = totalBackFee.add(fee);//累计退款金额 |
| | | } |
| | | } |
| | | List<YwContractBill> ywContractBillList = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>() |
| | | .lambda().eq(YwContractBill::getContractId,param.getId()).orderByDesc(YwContractBill::getId)); |
| | | Integer sortNum = ywContractBillList.size(); |
| | | if(param.getAddBillList()!=null && param.getAddBillList().size()>0){ |
| | | for(YwContractBill addBill : param.getAddBillList()){ |
| | | sortNum = sortNum + 1 ; |
| | | addBill.setIsdeleted(Constants.ZERO); |
| | | addBill.setContractId(param.getId()); |
| | | addBill.setType(Constants.ONE); |
| | | addBill.setStatus(Constants.ZERO); |
| | | addBill.setTotleFee(addBill.getReceivableFee()); |
| | | if(Constants.equalsInteger(addBill.getFeeType(),Constants.ONE)){ |
| | | addBill.setStartDate(addBill.getPlanPayDate()); |
| | | addBill.setEndDate(addBill.getPlanPayDate()); |
| | |
| | | addBill.setBtUserId(param.getBtUserId()); |
| | | addBill.setBtSignDate(param.getBtSignDate()); |
| | | addBill.setBtType(param.getBtType()); |
| | | addBill.setSortnum(sortNum ); |
| | | newBills.add(addBill); |
| | | } |
| | | ywContractBillMapper.insert(param.getAddBillList());//批量插入数据 |
| | |
| | | } |
| | | int num =1; |
| | | for(int i=0;i<billList1.size();i++){ |
| | | billList1.get(i).setSortnum(num); |
| | | num++; |
| | | if(Constants.equalsInteger( billList1.get(i).getCostType(),Constants.ZERO)){ |
| | | billList1.get(i).setSortnum(num++); |
| | | } |
| | | } |
| | | num =1; |
| | | for(int i=0;i<billList2.size();i++){ |
| | | billList2.get(i).setSortnum(num); |
| | | num++; |
| | | if(Constants.equalsInteger( billList2.get(i).getCostType(),Constants.ONE)){ |
| | | billList2.get(i).setSortnum(num++); |
| | | } |
| | | } |
| | | if(model.getId()!=null){ |
| | | ywContractBillMapper.insert(billList1); |