From b6184e2ddf3db37a94f7efb3b619bbc64642a292 Mon Sep 17 00:00:00 2001
From: chengf <cgf12138@163.com>
Date: 星期二, 27 一月 2026 18:12:48 +0800
Subject: [PATCH] Z四

---
 service-community/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java |  177 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 132 insertions(+), 45 deletions(-)

diff --git a/service-community/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java b/service-community/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java
old mode 100644
new mode 100755
index 48dc39e..4214703
--- a/service-community/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java
+++ b/service-community/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java
@@ -1,20 +1,24 @@
 package com.java110.community.smo.impl;
 
-
-import com.java110.utils.cache.MappingCache;
-import com.java110.utils.constant.StatusConstant;
-import com.java110.utils.util.BeanConvertUtil;
 import com.java110.community.dao.IRoomAttrServiceDao;
 import com.java110.community.dao.IRoomServiceDao;
 import com.java110.core.base.smo.BaseServiceSMO;
-import com.java110.core.smo.room.IRoomInnerServiceSMO;
-import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.core.log.LoggerFactory;
 import com.java110.dto.PageDto;
-import com.java110.dto.RoomAttrDto;
-import com.java110.dto.RoomDto;
+import com.java110.dto.room.RoomAttrDto;
+import com.java110.dto.room.RoomDto;
+import com.java110.dto.owner.OwnerRoomRelDto;
 import com.java110.dto.user.UserDto;
+import com.java110.dto.importData.ImportCustomCreateFeeDto;
+import com.java110.dto.importData.ImportRoomFee;
+import com.java110.intf.community.IRoomInnerServiceSMO;
+import com.java110.intf.user.IOwnerRoomRelV1InnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.po.room.RoomPo;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.*;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -46,6 +50,9 @@
     @Autowired
     private IUserInnerServiceSMO userInnerServiceSMOImpl;
 
+    @Autowired
+    private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl;
+
     @Override
     public List<RoomDto> queryRooms(@RequestBody RoomDto roomDto) {
 
@@ -59,7 +66,11 @@
 
         List<RoomDto> rooms = BeanConvertUtil.covertBeanList(roomServiceDaoImpl.getRoomInfoByCommunityId(BeanConvertUtil.beanCovertMap(roomDto)), RoomDto.class);
 
-        if (rooms == null || rooms.size() == 0) {
+        if (ListUtil.isNull(rooms)) {
+            return rooms;
+        }
+
+        if (rooms.size() > 50) {
             return rooms;
         }
 
@@ -68,20 +79,38 @@
         attrParamInfo.put("roomIds", roomIds);
         attrParamInfo.put("statusCd", StatusConstant.STATUS_CD_VALID);
         List<RoomAttrDto> roomAttrDtos = BeanConvertUtil.covertBeanList(roomAttrServiceDaoImpl.getRoomAttrInfo(attrParamInfo), RoomAttrDto.class);
-
-        String[] userIds = getUserIds(rooms);
-        //鏍规嵁 userId 鏌ヨ鐢ㄦ埛淇℃伅
-        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+        List<UserDto> users = null;
+        if (rooms.size() < 2) {
+            String[] userIds = getUserIds(rooms);
+            //鏍规嵁 userId 鏌ヨ鐢ㄦ埛淇℃伅
+            users = userInnerServiceSMOImpl.getUserInfo(userIds);
+        } else {
+            users = new ArrayList<>();
+        }
 
         for (RoomDto room : rooms) {
             try {
-                room.setApartmentName(MappingCache.getValue(room.getApartment().substring(0, 2).toString()) + MappingCache.getValue(room.getApartment().substring(2, 5).toString()));
+                OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
+                ownerRoomRelDto.setRoomId(room.getRoomId());
+                List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
+                try {
+                    Assert.listOnlyOne(ownerRoomRelDtos, "鏌ヨ涓氫富鎴垮眿鍏崇郴琛ㄩ敊璇紒");
+                    room.setApartmentName(MappingCache.getValue(room.getApartment().substring(0, 2).toString()) + MappingCache.getValue(room.getApartment().substring(2, 5).toString()));
+                    room.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
+                    room.setOwnerName(ownerRoomRelDtos.get(0).getOwnerName());
+                } catch (Exception ignored) {}
             } catch (Exception e) {
                 logger.error("璁剧疆鎴垮眿鎴峰瀷澶辫触", e);
             }
             refreshRoom(room, users, roomAttrDtos);
         }
         return rooms;
+    }
+
+    @Override
+    public int updateRooms(@RequestBody RoomPo roomPo) {
+        roomServiceDaoImpl.updateRoomInfoInstance(BeanConvertUtil.beanCovertMap(roomPo));
+        return 1;
     }
 
     /**
@@ -98,23 +127,21 @@
             }
         }
 
-        if (roomAttrDtos == null || roomAttrDtos.size() == 0) {
+        if (ListUtil.isNull(roomAttrDtos)) {
             return;
         }
 
+        List<RoomAttrDto> tmpRoomAttrDtos = new ArrayList<>();
         for (RoomAttrDto roomAttrDto : roomAttrDtos) {
             if (!roomAttrDto.getRoomId().equals(room.getRoomId())) {
                 continue;
             }
-
-            List<RoomAttrDto> tmpRoomAttrDtos = room.getRoomAttrDto();
-
-            if (tmpRoomAttrDtos == null) {
-                tmpRoomAttrDtos = new ArrayList<>();
+            if (StringUtil.isEmpty(roomAttrDto.getValueName())) {
+                roomAttrDto.setValueName(roomAttrDto.getValue());
             }
-
             tmpRoomAttrDtos.add(roomAttrDto);
         }
+        room.setRoomAttrDto(tmpRoomAttrDtos);
     }
 
     /**
@@ -242,33 +269,93 @@
     @Override
     public List<RoomDto> queryRoomsByOwner(@RequestBody RoomDto roomDto) {
 
-        List<RoomDto> rooms = BeanConvertUtil.covertBeanList(roomServiceDaoImpl.getRoomInfoByOwner(BeanConvertUtil.beanCovertMap(roomDto)),
-                RoomDto.class);
-
-        if (rooms == null || rooms.size() == 0) {
-            return rooms;
+        OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
+        ownerRoomRelDto.setOwnerId(roomDto.getOwnerId());
+        ownerRoomRelDto.setOwnerNameLike(roomDto.getOwnerNameLike());
+        ownerRoomRelDto.setStatusCd(roomDto.getStatusCd());
+        List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
+        if (ListUtil.isNull(ownerRoomRelDtos)) {
+            return new ArrayList<>();
         }
 
-        String[] roomIds = getRoomIds(rooms);
-        Map attrParamInfo = new HashMap();
-        attrParamInfo.put("roomIds", roomIds);
-        attrParamInfo.put("statusCd", StatusConstant.STATUS_CD_VALID);
-        List<RoomAttrDto> roomAttrDtos = BeanConvertUtil.covertBeanList(roomAttrServiceDaoImpl.getRoomAttrInfo(attrParamInfo), RoomAttrDto.class);
-
-        String[] userIds = getUserIds(rooms);
-        //鏍规嵁 userId 鏌ヨ鐢ㄦ埛淇℃伅
-        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
-
-        for (RoomDto room : rooms) {
-            //澶勭悊涓嬫埛鍨嬭浆涔夐棶棰�
-            try {
-                room.setApartment(MappingCache.getValue(room.getApartment().substring(0, 2).toString()) + MappingCache.getValue(room.getApartment().substring(2, 5).toString()));
-            } catch (Exception e) {
-                logger.error("璁剧疆鎴垮眿鎴峰瀷澶辫触", e);
+        RoomDto tmpRoomDto = new RoomDto();
+        List<String> roomIds = new ArrayList<>();
+        for (OwnerRoomRelDto tmpOwnerRoomRelDto : ownerRoomRelDtos) {
+            roomIds.add(tmpOwnerRoomRelDto.getRoomId());
+            tmpRoomDto.setOwnerId(tmpOwnerRoomRelDto.getOwnerId());
+            tmpRoomDto.setOwnerName(tmpOwnerRoomRelDto.getOwnerName());
+        }
+        tmpRoomDto.setRoomIds(roomIds.toArray(new String[roomIds.size()]));
+        tmpRoomDto.setRoomNum(roomDto.getRoomNum());
+        tmpRoomDto.setCommunityId(roomDto.getCommunityId());
+        List<RoomDto> roomDtos = queryRooms(tmpRoomDto);
+        if(ListUtil.isNull(roomDtos)){
+            return roomDtos;
+        }
+        for (OwnerRoomRelDto tmpOwnerRoomRelDto : ownerRoomRelDtos) {
+            for(RoomDto tRoomDto:roomDtos){
+                if(!tmpOwnerRoomRelDto.getRoomId().equals(tRoomDto.getRoomId())){
+                    continue;
+                }
+                tRoomDto.setStartTime(tmpOwnerRoomRelDto.getStartTime());
+                tRoomDto.setEndTime(tmpOwnerRoomRelDto.getEndTime());
             }
-            refreshRoom(room, users, roomAttrDtos);
         }
-        return rooms;
+
+        return roomDtos;
+
+    }
+
+    /**
+     * 鍒锋柊roomId
+     *
+     * @param importRoomFees 鏁版嵁瀵硅薄鍒嗕韩
+     * @return
+     */
+    @Override
+    public List<ImportRoomFee> freshRoomIds(@RequestBody List<ImportRoomFee> importRoomFees) {
+        for (ImportRoomFee importRoomFee : importRoomFees) {
+            List<Map> infos = null;
+            if (!StringUtil.isEmpty(importRoomFee.getRoomId()) && !importRoomFee.getRoomId().startsWith("-")) {
+                Map paramIn = new HashMap();
+                paramIn.put("communityId", importRoomFee.getCommunityId());
+                paramIn.put("roomId", importRoomFee.getRoomId());
+                infos = roomServiceDaoImpl.getRoomInfos(BeanConvertUtil.beanCovertMap(importRoomFee));
+            } else {
+                infos = roomServiceDaoImpl.getRoomInfos(BeanConvertUtil.beanCovertMap(importRoomFee));
+            }
+
+            if (infos == null || infos.size() < 1) {
+                continue;
+            }
+            importRoomFee.setRoomId(infos.get(0).get("roomId").toString());
+            importRoomFee.setFloorNum(infos.get(0).get("floorNum").toString());
+            importRoomFee.setUnitNum(infos.get(0).get("unitNum").toString());
+            importRoomFee.setRoomNum(infos.get(0).get("roomNum").toString());
+            importRoomFee.setRoomName(importRoomFee.getFloorNum() + "-" + importRoomFee.getUnitNum() + "-" + importRoomFee.getRoomNum());
+
+        }
+        return importRoomFees;
+    }
+
+    public List<ImportCustomCreateFeeDto> freshRoomIdsByImportCustomCreateFee(@RequestBody List<ImportCustomCreateFeeDto> importCustomCreateFeeDtos) {
+        for (ImportCustomCreateFeeDto importRoomFee : importCustomCreateFeeDtos) {
+            List<Map> infos = null;
+            infos = roomServiceDaoImpl.getRoomInfos(BeanConvertUtil.beanCovertMap(importRoomFee));
+            if (infos == null || infos.size() < 1) {
+                continue;
+            }
+            importRoomFee.setPayObjId(infos.get(0).get("roomId").toString());
+            importRoomFee.setFloorNum(infos.get(0).get("floorNum").toString());
+            importRoomFee.setUnitNum(infos.get(0).get("unitNum").toString());
+            importRoomFee.setRoomNum(infos.get(0).get("roomNum").toString());
+        }
+        return importCustomCreateFeeDtos;
+    }
+
+    @Override
+    public List<Map> queryRoomsAsReport(RoomDto roomDto) {
+        return roomServiceDaoImpl.queryRoomsAsReport(BeanConvertUtil.beanCovertMap(roomDto));
     }
 
     public IRoomServiceDao getRoomServiceDaoImpl() {

--
Gitblit v1.8.0