| | |
| | | return R.ok(screenService.rentIncomeTrend()); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getTenantCountTrend") |
| | | @ApiOperation(value = "租户数量趋势统计") |
| | | public R<List<TenantCountTrendVO>> getTenantCountTrend() { |
| | | |
| | | String businessDeptId = SecurityUtils.getBusinessDeptId(); |
| | | Date currentDate = new Date(); |
| | | Date targetDate = DateUtils.addMonths(currentDate, -3 * 6); |
| | | Map<String, Date> startQuarterDate = DateUtils.getQuarterDate(targetDate); |
| | | |
| | | |
| | | Date targetDate2 = DateUtils.addMonths(currentDate, 0); |
| | | Map<String, Date> endQuarterDate = DateUtils.getQuarterDate(targetDate2); |
| | | |
| | | List<TContract> contracts = contractService.list(new LambdaQueryWrapper<TContract>() |
| | | .eq(!"0".equals(businessDeptId),TContract::getBusinessDeptId, businessDeptId) |
| | | .isNotNull(TContract::getSignTime) |
| | | .between(TContract::getSignTime, startQuarterDate.get("first"), endQuarterDate.get("last")) |
| | | .orderByAsc(TContract::getSignTime)); |
| | | |
| | | DateTimeFormatter quarterFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | |
| | | List<TenantCountTrendVO> trendData = contracts.stream() |
| | | .collect(Collectors.groupingBy(contract -> { |
| | | LocalDate date = contract.getSignTime().toLocalDate(); |
| | | int quarter = (date.getMonthValue() - 1) / 3 + 1; |
| | | return YearQuarter.from(date.withMonth(quarter * 3 - 2)); |
| | | }, TreeMap::new, Collectors.counting())) |
| | | .entrySet().stream() |
| | | .map(entry -> new TenantCountTrendVO( |
| | | entry.getKey().format(quarterFormatter), |
| | | entry.getValue())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return R.ok(trendData); |
| | | return screenService.getTenantCountTrend(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | String businessDeptId = SecurityUtils.getBusinessDeptId(); |
| | | // 获取所有房屋信息 |
| | | List<TContract> tContracts = contractService.list(new LambdaQueryWrapper<TContract>() |
| | | .eq(!"0".equals(businessDeptId), TContract::getBusinessDeptId, businessDeptId) |
| | | .eq(TContract::getPayType, 1)); |
| | | List<String> houseIds = tContracts.stream().map(TContract::getHouseId).collect(Collectors.toList()); |
| | | if (houseIds.isEmpty()){ |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<THouse> houses = houseService.list(new LambdaQueryWrapper<THouse>() |
| | | .eq(!"0".equals(businessDeptId),THouse::getBusinessDeptId, businessDeptId)); |
| | | .eq(!"0".equals(businessDeptId),THouse::getBusinessDeptId, businessDeptId) |
| | | .in(THouse::getId, houseIds)); |
| | | List<HouseMapDistributionVO> result = new ArrayList<>(); |
| | | for (THouse house : houses) { |
| | | HouseMapDistributionVO houseMapDistributionVO = new HouseMapDistributionVO(); |
| | |
| | | houseMapDistributionVO.setLatitude(house.getLatitude()); |
| | | TContract contract = contractService.getOne(new LambdaQueryWrapper<TContract>() |
| | | .eq(!"0".equals(businessDeptId),TContract::getBusinessDeptId, businessDeptId) |
| | | .eq(TContract::getPayType, 1) |
| | | .gt(TContract::getEndTime, LocalDate.now()) |
| | | .eq(TContract::getHouseId, house.getId()) |
| | | .eq(TContract::getStatus, 4) |
| | |
| | | long monthsBetween = ChronoUnit.MONTHS.between(startTime, endTime); |
| | | BigDecimal payableFeesMoney = monthRent.multiply(new BigDecimal(monthsBetween)); |
| | | |
| | | BigDecimal paidAlready = tBills.stream() |
| | | .map(TBill::getPayableFeesMoney) |
| | | BigDecimal payFeesMoney = tBills.stream() |
| | | .map(TBill::getPayFeesMoney) |
| | | .reduce(BigDecimal::add) |
| | | .orElse(BigDecimal.ZERO); |
| | | String rentStatus = String.format("%.2f/%.2f", paidAlready, payableFeesMoney); |
| | | String rentStatus = String.format("%.2f/%.2f", payFeesMoney, payableFeesMoney); |
| | | houseMapDistributionVO.setRentStatus(rentStatus); |
| | | |
| | | |
| | |
| | | if ("4".equals(one.getPayFeesStatus())){ |
| | | houseMapDistributionVO.setHouseStatus("4"); |
| | | } |
| | | BigDecimal payFeesMoney = one.getPayFeesMoney(); |
| | | BigDecimal payFeesMoney1 = one.getPayFeesMoney(); |
| | | BigDecimal payableFeesMoney1 = one.getPayableFeesMoney(); |
| | | String rent = String.format("%.2f/%.2f", payFeesMoney, payableFeesMoney1); |
| | | String rent = String.format("%.2f/%.2f", payFeesMoney1, payableFeesMoney1); |
| | | houseMapDistributionVO.setRent(rent); |
| | | }else { |
| | | houseMapDistributionVO.setRent("暂无"); |
| | |
| | | }else { |
| | | houseMapDistributionVO.setTenant("暂无"); |
| | | houseMapDistributionVO.setRentStatus("暂无"); |
| | | houseMapDistributionVO.setRent("暂无"); |
| | | houseMapDistributionVO.setRent("欠费"); |
| | | } |
| | | result.add(houseMapDistributionVO); |
| | | } |