xiongzhu пре 5 година
родитељ
комит
9cb0cb0099

+ 0 - 0
db/migrate006.sql


+ 22 - 20
src/main/java/com/izouma/zhumj/domain/RoomInfo.java

@@ -29,7 +29,7 @@ import java.util.List;
 @JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
 public class RoomInfo extends BaseEntity implements Serializable {
 
-    @ApiModelProperty(value = "门店Id", name = "storeId")
+    @ApiModelProperty("门店Id")
     private Long storeId;
 
     @ManyToOne(fetch = FetchType.LAZY)
@@ -39,15 +39,15 @@ public class RoomInfo extends BaseEntity implements Serializable {
 
     @Column(nullable = false)
     @Searchable
-    @ApiModelProperty(value = "房间名称", name = "roomName")
+    @ApiModelProperty("房间名称")
     private String roomName;
 
     @Column(nullable = false)
     @Searchable
-    @ApiModelProperty(value = "房间号码", name = "roomCode")
+    @ApiModelProperty("房间号码")
     private String roomCode;
 
-    @ApiModelProperty(value = "房型Id", name = "roomTypeId")
+    @ApiModelProperty("房型Id")
     private Long roomTypeId;
 
     @ManyToOne(fetch = FetchType.LAZY)
@@ -55,7 +55,7 @@ public class RoomInfo extends BaseEntity implements Serializable {
     @JsonIgnore
     private RoomTypeInfo roomTypeInfo;
 
-    @ApiModelProperty(value = "楼栋Id", name = "buildingId")
+    @ApiModelProperty("楼栋Id")
     private Long buildingId;
 
     @ManyToOne(fetch = FetchType.LAZY)
@@ -63,7 +63,7 @@ public class RoomInfo extends BaseEntity implements Serializable {
     @JsonIgnore
     private BuildingInfo buildingInfo;
 
-    @ApiModelProperty(value = "楼层Id", name = "floorId")
+    @ApiModelProperty("楼层Id")
     private Long floorId;
 
     @ManyToOne(fetch = FetchType.LAZY)
@@ -72,44 +72,44 @@ public class RoomInfo extends BaseEntity implements Serializable {
     private FloorInfo floorInfo;
 
     @Searchable
-    @ApiModelProperty(value = "门卡", name = "doorCard")
+    @ApiModelProperty("门卡")
     private String doorCard;
 
-    @ApiModelProperty(value = "预定状态", name = "bookStatus")
+    @ApiModelProperty("预定状态")
     @Enumerated(EnumType.STRING)
     private BookStatus bookStatus;
 
-    @ApiModelProperty(value = "入住状态", name = "checkInStatus")
+    @ApiModelProperty("入住状态")
     @Enumerated(EnumType.STRING)
     private CheckInStatus checkInStatus;
 
-    @ApiModelProperty(value = "卫生状态", name = "cleaningStatus")
+    @ApiModelProperty("卫生状态")
     @Enumerated(EnumType.STRING)
     private CleaningStatus cleaningStatus;
 
-    @ApiModelProperty(value = "维修状态", name = "repairStatus")
+    @ApiModelProperty("维修状态")
     @Enumerated(EnumType.STRING)
     private RepairStatus repairStatus;
 
-    @ApiModelProperty(value = "锁定状态", name = "lockStatus")
+    @ApiModelProperty("锁定状态")
     @Enumerated(EnumType.STRING)
     private LockStatus lockStatus;
 
-    @ApiModelProperty(value = "联系电话", name = "telephone")
+    @ApiModelProperty("联系电话")
     private String telephone;
 
     @Column(precision = 10, scale = 2)
-    @ApiModelProperty(value = "余额", name = "balance")
+    @ApiModelProperty("余额")
     private BigDecimal balance;
 
-    @ApiModelProperty(value = "备注", name = "remark")
+    @ApiModelProperty("备注")
     private String remark;
 
     @Column(nullable = false)
-    @ApiModelProperty(value = "有效", name = "enabled")
+    @ApiModelProperty("有效")
     private Boolean enabled = true;
 
-    @ApiModelProperty(value = "明亮的", name = "bright")
+    @ApiModelProperty("明亮的")
     private Boolean bright = true;
 
     @OneToMany(fetch = FetchType.LAZY)
@@ -119,13 +119,15 @@ public class RoomInfo extends BaseEntity implements Serializable {
     List<BedInfo> bedInfos;
 
     @Column(name = "\"virtual\"")
-    @ApiModelProperty(value = "虚拟房", name = "virtual")
+    @ApiModelProperty("虚拟房")
     private Boolean virtual = false;
 
-    @ApiModelProperty(value = "原房间Id", name = "srcRoomId")
+    @ApiModelProperty("原房间Id")
     private Long srcRoomId;
 
-    @ApiModelProperty(value = "电表设备ID", name = "deviceId")
+    @ApiModelProperty("电表设备ID")
     private String deviceId;
 
+    @ApiModelProperty("白领房间")
+    private boolean single;
 }

+ 2 - 2
src/main/java/com/izouma/zhumj/dto/CheckinInfoDTO.java

@@ -104,10 +104,10 @@ public class CheckinInfoDTO {
         this.dayRate = dayRate;
     }
 
-    public CheckinInfoDTO(String idNo, BigDecimal monthRate, BigDecimal dayRate, Long bedCount) {
+    public CheckinInfoDTO(String idNo, BigDecimal monthRate, BigDecimal dayRate, Long roomId) {
         this.idNo = idNo;
         this.monthRate = monthRate;
         this.dayRate = dayRate;
-        this.bedCount = bedCount;
+        this.roomId = roomId;
     }
 }

+ 2 - 2
src/main/java/com/izouma/zhumj/dto/StoreStat.java

@@ -6,9 +6,9 @@ import java.math.BigDecimal;
 
 @Data
 public class StoreStat {
-    private int total;
+    private int totalBed;
 
-    private int totalSec;
+    private int totalRoom;
 
     private int checkin;
 

+ 12 - 10
src/main/java/com/izouma/zhumj/repo/CheckinInfoRepo.java

@@ -41,20 +41,22 @@ public interface CheckinInfoRepo extends JpaRepository<CheckinInfo, Long>, JpaSp
 
     List<CheckinInfo> findAllByStoreIdAndCheckoutIsFalse(Long storeId);
 
-    @Query("SELECT new com.izouma.zhumj.dto.CheckinInfoDTO(s.idNo, s.monthRate, s.dayRate, rt.bedCount) " +
+    @Query("SELECT new com.izouma.zhumj.dto.CheckinInfoDTO(s.idNo, s.monthRate, s.dayRate) " +
             "FROM CheckinInfo s " +
-            "  join RoomInfo r on s.roomId = r.id " +
-            "  join RoomTypeInfo rt on r.roomTypeId = rt.id " +
-            "WHERE s.checkout = false and s.storeId = ?1")
-    List<CheckinInfoDTO> storeCheckinDTO(Long storeId);
+            "WHERE s.storeId = ?1 and s.checkout = false ")
+    List<CheckinInfoDTO> monthRateReport(Long storeId);
 
+    @Query("SELECT new com.izouma.zhumj.dto.CheckinInfoDTO(s.idNo, s.monthRate, s.dayRate) " +
+            "FROM CheckinInfo s " +
+            "WHERE s.storeId = ?1 and " +
+            "  ((s.checkinTime <= ?2 and s.checkoutTime >= ?3 and s.checkout = true) " +
+            "  or (s.checkinTime <= ?2 and s.checkout = false))")
+    List<CheckinInfoDTO> monthRateReport(Long storeId, LocalDateTime start, LocalDateTime end);
 
-    @Query("SELECT new com.izouma.zhumj.dto.CheckinInfoDTO(s.idNo, s.monthRate, s.dayRate, rt.bedCount) " +
+    @Query("SELECT new com.izouma.zhumj.dto.CheckinInfoDTO(s.idNo, s.monthRate, s.dayRate, s.roomId) " +
             "FROM CheckinInfo s " +
-            "  join RoomInfo r on s.roomId = r.id " +
-            "  join RoomTypeInfo rt on r.roomTypeId = rt.id " +
-            "  WHERE ((s.checkinTime <= ?3 and s.checkoutTime >= ?2 and s.checkout = true ) or (s.checkinTime <= ?3 and s.checkout = false )) and s.storeId = ?1")
-    List<CheckinInfoDTO> pastStoreCheckinDTO(Long storeId, LocalDateTime start, LocalDateTime end);
+            "WHERE s.checkout = false and s.storeId = ?1")
+    List<CheckinInfoDTO> storeCheckinDTO(Long storeId);
 
     @Query("SELECT s.roomId FROM CheckinInfo s WHERE s.checkout = false  and s.storeId = ?1  and s.sex = ?2")
     Set<Long> findAllRoomIdByStoreIdAndSex(Long storeId, String sex);

+ 1 - 8
src/main/java/com/izouma/zhumj/repo/RoomInfoRepo.java

@@ -31,15 +31,8 @@ public interface RoomInfoRepo extends JpaRepository<RoomInfo, Long>, JpaSpecific
 
     Long countAllByStoreIdAndRoomTypeIdAndRepairStatus(Long storeId, Long roomTypeId, RepairStatus repairStatus);
 
-    @Query("SELECT s.id FROM RoomInfo s WHERE  s.storeId = ?1  and (s.roomCode like CONCAT(?2,'%') or s.roomName like CONCAT(?2,'%'))")
+    @Query("SELECT s.id FROM RoomInfo s WHERE s.enabled = true and s.storeId = ?1  and (s.roomCode like CONCAT(?2,'%') or s.roomName like CONCAT(?2,'%'))")
     Set<Long> findAllRoomIdByStoreIdAndSearchKey(Long storeId, String searchKey);
 
     RoomInfo findRoomInfoBySrcRoomId(Long id);
-
-    /**
-     * @param storeId 门店ID
-     * @param checkInStatus 入住状态
-     * @return 门店指定状态房间的总数
-     */
-    Long countAllByStoreIdAndCheckInStatus(Long storeId,CheckInStatus checkInStatus);
 }

+ 1 - 0
src/main/java/com/izouma/zhumj/service/CheckinInfoService.java

@@ -583,6 +583,7 @@ public class CheckinInfoService {
                     .teamName(checkinInfo.getTeamName())
                     .saleId(contract.getSaleId())
                     .customerId(checkinInfo.getCustomerId())
+                    .suspend(false)
                     .build();
             checkinInfoRepo.save(newCheckinInfo);
         }

+ 65 - 33
src/main/java/com/izouma/zhumj/service/RoomInfoService.java

@@ -10,13 +10,16 @@ import com.izouma.zhumj.exception.BusinessException;
 import com.izouma.zhumj.repo.*;
 import com.izouma.zhumj.repo.sale.ContractStoreRepo;
 import com.izouma.zhumj.repo.sale.ContractRepo;
+import com.izouma.zhumj.utils.ObjUtils;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 import java.math.BigDecimal;
@@ -40,7 +43,19 @@ public class RoomInfoService {
     private RoomFeeRepo       roomFeeRepo;
     private UserRepo          userRepo;
     private MemberRepo        memberRepo;
-
+    private RoomTypeInfoRepo  roomTypeInfoRepo;
+
+    public RoomInfo save(RoomInfo record) {
+        record.setSingle(roomTypeInfoRepo.findById(record.getRoomTypeId())
+                .map(RoomTypeInfo::getBedCount)
+                .orElse(0L) == 1);
+        if (record.getId() != null) {
+            RoomInfo orig = roomInfoRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return roomInfoRepo.save(orig);
+        }
+        return roomInfoRepo.save(record);
+    }
 
     public HomeRoomDTO getHomeInfo(RoomInfoQueryDTO baseDto) throws CloneNotSupportedException {
         RoomInfoQueryDTO totalRoomCountDTO = (RoomInfoQueryDTO) baseDto.clone();
@@ -129,71 +144,88 @@ public class RoomInfoService {
         StoreStat lanling = new StoreStat();
         StoreStat bailing = new StoreStat();
 
+        List<RoomInfo> roomInfos = roomInfoRepo.findAll((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
+        {
+            List<Predicate> predicates = new ArrayList<>();
+            predicates.add(criteriaBuilder.equal(root.get("storeId"), storeId));
+            predicates.add(criteriaBuilder.equal(root.get("enabled"), true));
+            predicates.add(criteriaBuilder.equal(root.get("virtual"), false));
+            if (buildingId != null) {
+                predicates.add(criteriaBuilder.equal(root.get("buildingId"), buildingId));
+            }
+            if (floorId != null) {
+                predicates.add(criteriaBuilder.equal(root.get("floorId"), floorId));
+            }
+            if (roomTypeId != null) {
+                predicates.add(criteriaBuilder.equal(root.get("roomTypeId"), roomTypeId));
+            }
+            return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
+        });
+
         List<CheckinInfoDTO> checkinInfoList = checkinInfoRepo.storeCheckinDTO(storeId);
-        checkinInfoList.sort(Comparator.comparingLong(CheckinInfoDTO::getBedCount));
 
-        lanling.setTotal((int) bedInfoRepo.count((Specification<BedInfo>) (root, criteriaQuery, criteriaBuilder) ->
-                criteriaBuilder.and(criteriaBuilder.equal(root.get("storeId"), storeId),
-                        criteriaBuilder.equal(root.get("enabled"), true),
-                        criteriaBuilder.equal(root.join("roomInfo").get("virtual"), false),
-                        criteriaBuilder.notEqual(root.join("roomInfo")
-                                .join("roomTypeInfo")
-                                .get("bedCount"), 1))
-        ));
-        lanling.setTotalSec((int) roomInfoRepo.count((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
+        Set<Long> lanlingRoomIds = roomInfos.stream()
+                .filter(roomInfo -> !roomInfo.isSingle())
+                .map(BaseEntity::getId)
+                .collect(Collectors.toSet());
+        List<CheckinInfoDTO> lanlingCheckinInfoList = checkinInfoList.stream()
+                .filter(c -> lanlingRoomIds.contains(c.getRoomId()))
+                .collect(Collectors.toList());
+        lanling.setTotalBed(lanlingRoomIds.isEmpty() ? 0 : (int) bedInfoRepo.count((Specification<BedInfo>) (root, criteriaQuery, criteriaBuilder) ->
                 criteriaBuilder.and(criteriaBuilder.equal(root.get("storeId"), storeId),
                         criteriaBuilder.equal(root.get("enabled"), true),
                         criteriaBuilder.equal(root.get("virtual"), false),
-                        criteriaBuilder.notEqual(root.join("roomTypeInfo").get("bedCount"), 1))
-        ));
+                        root.get("roomId").in(lanlingRoomIds)
+                )));
+        lanling.setTotalRoom(lanlingRoomIds.size());
 
-        lanling.setCheckin((int) checkinInfoList.stream().filter(c -> c.getBedCount() != 1).count());
+        lanling.setCheckin(lanlingCheckinInfoList.size());
 
-        lanling.setActual((int) checkinInfoList.stream()
-                .filter(c -> c.getBedCount() != 1 && StringUtils.isNotBlank(c.getIdNo()))
+        lanling.setActual((int) lanlingCheckinInfoList.stream()
+                .filter(c -> StringUtils.isNotBlank(c.getIdNo()))
                 .count());
 
-        lanling.setAvgPrice(BigDecimal.valueOf(checkinInfoList.stream()
-                .filter(c -> c.getBedCount() != 1)
+        lanling.setAvgPrice(BigDecimal.valueOf(lanlingCheckinInfoList.stream()
                 .mapToDouble(c -> Optional.ofNullable(c.getMonthRate()).orElse(BigDecimal.ZERO).doubleValue())
                 .average()
                 .orElse(0)).setScale(2, RoundingMode.HALF_UP));
 
-        if (lanling.getTotal() == 0) {
+        if (lanling.getTotalBed() == 0) {
             lanling.setPercent("0%");
         } else {
             lanling.setPercent(BigDecimal.valueOf(lanling.getCheckin())
-                    .divide(BigDecimal.valueOf(lanling.getTotal()), 4, RoundingMode.HALF_UP)
+                    .divide(BigDecimal.valueOf(lanling.getTotalBed()), 4, RoundingMode.HALF_UP)
                     .multiply(BigDecimal.valueOf(100).setScale(2, RoundingMode.HALF_UP))
                     .stripTrailingZeros()
                     .toPlainString() + "%");
         }
 
 
-        bailing.setTotal((int) roomInfoRepo.count((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
-                criteriaBuilder.and(criteriaBuilder.equal(root.get("storeId"), storeId),
-                        criteriaBuilder.equal(root.get("enabled"), true),
-                        criteriaBuilder.equal(root.get("virtual"), false),
-                        criteriaBuilder.and(criteriaBuilder.equal(root.join("roomTypeInfo").get("bedCount"), 1)))
-        ));
+        Set<Long> bailingRoomIds = roomInfos.stream()
+                .filter(RoomInfo::isSingle)
+                .map(BaseEntity::getId)
+                .collect(Collectors.toSet());
+        List<CheckinInfoDTO> bailingCheckinInfoList = checkinInfoList.stream()
+                .filter(c -> bailingRoomIds.contains(c.getRoomId()))
+                .collect(Collectors.toList());
+        bailing.setTotalRoom(bailingRoomIds.size());
 
-        bailing.setCheckin((int) checkinInfoList.stream().filter(c -> c.getBedCount() == 1).count());
+        bailing.setCheckin(bailingCheckinInfoList.size());
 
-        bailing.setActual((int) checkinInfoList.stream()
-                .filter(c -> c.getBedCount() == 1 && StringUtils.isNotBlank(c.getIdNo()))
+        bailing.setActual((int) bailingCheckinInfoList.stream()
+                .filter(c -> StringUtils.isNotBlank(c.getIdNo()))
                 .count());
 
-        bailing.setAvgPrice(BigDecimal.valueOf(checkinInfoList.stream()
-                .filter(c -> c.getBedCount() == 1)
+        bailing.setAvgPrice(BigDecimal.valueOf(bailingCheckinInfoList.stream()
                 .mapToDouble(c -> Optional.ofNullable(c.getMonthRate()).orElse(BigDecimal.ZERO).doubleValue())
                 .average()
                 .orElse(0)).setScale(2, RoundingMode.HALF_UP));
 
-        if (bailing.getTotal() == 0) {
+        if (bailing.getTotalRoom() == 0) {
             bailing.setPercent("0%");
         } else {
             bailing.setPercent(BigDecimal.valueOf(bailing.getCheckin())
-                    .divide(BigDecimal.valueOf(bailing.getTotal()), 4, RoundingMode.HALF_UP)
+                    .divide(BigDecimal.valueOf(bailing.getTotalRoom()), 4, RoundingMode.HALF_UP)
                     .multiply(BigDecimal.valueOf(100).setScale(2, RoundingMode.HALF_UP))
                     .stripTrailingZeros()
                     .toPlainString() + "%");

+ 6 - 4
src/main/java/com/izouma/zhumj/service/StoreNoticeService.java

@@ -21,6 +21,7 @@ import org.springframework.context.event.EventListener;
 import org.springframework.messaging.simp.SimpMessagingTemplate;
 import org.springframework.stereotype.Service;
 
+import javax.transaction.Transactional;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
@@ -132,6 +133,7 @@ public class StoreNoticeService {
         storeNoticeRepo.save(storeNotice);
     }
 
+    @Transactional
     public void done(Long id) {
         StoreNotice storeNotice = storeNoticeRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         if (storeNotice.getStoreNoticeType() == StoreNoticeType.RENEWAL) {
@@ -148,10 +150,10 @@ public class StoreNoticeService {
                     .flatMap(contractStore -> contractStore.getRoomTypes().stream())
                     .mapToInt(ContractRoomType::getBeds)
                     .sum();
-            int currentBedNum = Math.toIntExact(checkinInfoRepo
-                    .countByOrderIdAndStoreIdAndCheckoutFalse(contract.getId(), storeNotice.getStoreId()))
-                    + Math.toIntExact(checkinInfoRepo
-                    .countByOrderIdAndStoreIdAndCheckoutFalse(newContract.getId(), storeNotice.getStoreId()));
+            int currentBedNum = Math.toIntExact(checkinInfoRepo.countByOrderIdAndStoreIdAndCheckoutFalse(
+                    contract.getId(), storeNotice.getStoreId()))
+                    + Math.toIntExact(checkinInfoRepo.countByOrderIdAndStoreIdAndCheckoutFalse(
+                    newContract.getId(), storeNotice.getStoreId()));
             if (contract.getCheckInType() != CheckInType.TEAM_POST_PAID) {
                 if (contractBedNum != currentBedNum) {
                     throw new BusinessException("当前入住人数与合同不匹配,当前入住:" + currentBedNum + ",合同人数:" + contractBedNum);

+ 4 - 4
src/main/java/com/izouma/zhumj/service/report/ReportService.java

@@ -1,5 +1,6 @@
 package com.izouma.zhumj.service.report;
 
+import com.izouma.zhumj.config.Constants;
 import com.izouma.zhumj.domain.*;
 import com.izouma.zhumj.domain.sale.Contract;
 import com.izouma.zhumj.domain.sale.Customer;
@@ -491,12 +492,11 @@ public class ReportService {
             long checkinBedCount = checkinInfoRepo.countByStoreIdAndCheckoutFalse(storeInfo.getId());
             long roomCount = roomInfoRepo.countAllByStoreId(storeInfo.getId());
             long freeBedCount = bedCount - checkinBedCount;
-            List<CheckinInfoDTO> checkinInfoList = new ArrayList<>();
+            List<CheckinInfoDTO> checkinInfoList;
             if (null == date) {
-                checkinInfoList = checkinInfoRepo.storeCheckinDTO(storeInfo.getId());
+                checkinInfoList = checkinInfoRepo.monthRateReport(storeInfo.getId());
             } else {
-                checkinInfoList = checkinInfoRepo.pastStoreCheckinDTO(storeInfo.getId(), date.atStartOfDay(), date
-                        .atTime(23, 59, 59, 99));
+                checkinInfoList = checkinInfoRepo.monthRateReport(storeInfo.getId(), date.atStartOfDay(), date.atTime(Constants.TIME_MAX));
                 checkinBedCount = checkinInfoList.size();
                 freeBedCount = bedCount - checkinBedCount;
             }

+ 1 - 6
src/main/java/com/izouma/zhumj/web/RoomInfoController.java

@@ -35,12 +35,7 @@ public class RoomInfoController extends BaseController {
 
     @PostMapping("/save")
     public RoomInfo save(@RequestBody RoomInfo record) {
-        if (record.getId() != null) {
-            RoomInfo orig = roomInfoRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
-            ObjUtils.merge(orig, record);
-            return roomInfoRepo.save(orig);
-        }
-        return roomInfoRepo.save(record);
+        return roomInfoService.save(record);
     }
 
     @GetMapping("/all")

+ 19 - 18
src/main/vue/src/views/Operation/RoomStatus.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="container room-status" ref="roomStatus" @scroll="roomScroll">
         <div class="top-stat" v-loading="statLoading" ref="menuList">
-            <div class="row lanling">
+            <div class="row lanling" v-if="statData.lanling">
                 <img src="../../assets/images/pc_home_icon_lanling.png" class="icon-title" />
                 <stat-item
                     v-for="(item, i) in statData.lanling"
@@ -685,27 +685,28 @@ export default {
                 .get('/roomInfo/storeStat', this.filterData)
                 .then(res => {
                     this.statLoading = false;
-                    this.statData = {
-                        lanling: [
-                            ['总房间/总床位', `${res.lanling.totalSec}/${res.lanling.total}`],
+                    let statData = {};
+                    if (res.lanling.totalRoom) {
+                        statData.lanling = [
+                            ['总房间/总床位', `${res.lanling.totalRoom}/${res.lanling.totalBed}`],
                             ['已出租床位', res.lanling.checkin],
                             ['实际在住床位', res.lanling.actual],
-                            ['剩余床位', res.lanling.total - res.lanling.checkin],
+                            ['剩余床位', res.lanling.totalBed - res.lanling.checkin],
                             ['月均价', res.lanling.avgPrice],
                             ['出租率', res.lanling.percent]
-                        ],
-                        bailing:
-                            res.bailing.total > 0
-                                ? [
-                                      ['总房间', res.bailing.total],
-                                      ['已出租房间', res.bailing.checkin],
-                                      ['实际在住房间', res.bailing.actual],
-                                      ['剩余房间', res.bailing.total - res.bailing.checkin],
-                                      ['月均价', res.bailing.avgPrice],
-                                      ['出租率', res.bailing.percent]
-                                  ]
-                                : null
-                    };
+                        ];
+                    }
+                    if (res.bailing.totalRoom) {
+                        statData.bailing = [
+                            ['总房间', res.bailing.totalRoom],
+                            ['已出租房间', res.bailing.checkin],
+                            ['实际在住房间', res.bailing.actual],
+                            ['剩余房间', res.bailing.totalRoom - res.bailing.checkin],
+                            ['月均价', res.bailing.avgPrice],
+                            ['出租率', res.bailing.percent]
+                        ];
+                    }
+                    this.statData = statData;
                 })
                 .catch(e => {
                     console.log(e);