Explorar el Código

查询业主加入房屋信息

java110 hace 5 años
padre
commit
43ca00caa7

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerDto.java

@@ -40,6 +40,7 @@ public class OwnerDto extends PageDto implements Serializable {
     private String[] ownerTypeCds;
     private String[] ownerTypeCds;
     private String ownerTypeName;
     private String ownerTypeName;
     private String roomNum;
     private String roomNum;
+    private String roomName;
     private String psId;
     private String psId;
     private String num;
     private String num;
     private String idCard;
     private String idCard;
@@ -286,4 +287,12 @@ public class OwnerDto extends PageDto implements Serializable {
     public void setRooms(List<RoomDto> rooms) {
     public void setRooms(List<RoomDto> rooms) {
         this.rooms = rooms;
         this.rooms = rooms;
     }
     }
+
+    public String getRoomName() {
+        return roomName;
+    }
+
+    public void setRoomName(String roomName) {
+        this.roomName = roomName;
+    }
 }
 }

+ 10 - 0
java110-bean/src/main/java/com/java110/vo/api/ApiOwnerDataVo.java

@@ -39,6 +39,8 @@ public class ApiOwnerDataVo extends Vo {
     private String ownerTypeCd;
     private String ownerTypeCd;
     private String ownerTypeName;
     private String ownerTypeName;
 
 
+    private String roomName;
+
     private List<OwnerAttrDto> ownerAttrDtos;
     private List<OwnerAttrDto> ownerAttrDtos;
 
 
     private String idCard;
     private String idCard;
@@ -146,4 +148,12 @@ public class ApiOwnerDataVo extends Vo {
     public void setOwnerAttrDtos(List<OwnerAttrDto> ownerAttrDtos) {
     public void setOwnerAttrDtos(List<OwnerAttrDto> ownerAttrDtos) {
         this.ownerAttrDtos = ownerAttrDtos;
         this.ownerAttrDtos = ownerAttrDtos;
     }
     }
+
+    public String getRoomName() {
+        return roomName;
+    }
+
+    public void setRoomName(String roomName) {
+        this.roomName = roomName;
+    }
 }
 }

+ 19 - 28
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml

@@ -118,6 +118,8 @@
     </insert>
     </insert>
 
 
 
 
+
+
     <!-- 查询业主信息 add by wuxw 2018-07-03 -->
     <!-- 查询业主信息 add by wuxw 2018-07-03 -->
     <select id="getOwnerInfo" parameterType="Map" resultType="Map">
     <select id="getOwnerInfo" parameterType="Map" resultType="Map">
         select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,
         select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,
@@ -125,33 +127,22 @@
         t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,
         t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,
         t.owner_type_cd ownerTypeCd,t.create_time createTime,t.community_id,
         t.owner_type_cd ownerTypeCd,t.create_time createTime,t.community_id,
         t.community_id communityId,t.id_card, t.id_card idCard,t.state,td.name ownerTypeName
         t.community_id communityId,t.id_card, t.id_card idCard,t.state,td.name ownerTypeName
-        <if test="roomIds != null">
-            , borr.room_id roomId
-        </if>
-        from building_owner t,t_dict td
-        <if test="roomId != null and roomId != ''">
-            ,building_owner_room_rel borr
-        </if>
-        <if test="roomIds != null ">
-            ,building_owner_room_rel borr
-        </if>
+        , borr.room_id roomId
+        from
+        building_owner t
+        left join t_dict td on td.table_name = 'building_owner' and td.`table_columns` = 'owner_type_cd' and td.status_cd = t.owner_type_cd
+        left join building_owner_room_rel borr on and borr.status_cd = '0' and t.owner_id = borr.owner_id
         where 1 =1
         where 1 =1
         <if test="roomId != null and roomId != ''">
         <if test="roomId != null and roomId != ''">
-            and t.owner_id = borr.owner_id
-            and borr.status_cd = '0'
             and borr.room_id = #{roomId}
             and borr.room_id = #{roomId}
         </if>
         </if>
         <if test="roomIds != null">
         <if test="roomIds != null">
-            and t.owner_id = borr.owner_id
-            and borr.status_cd = '0'
             and borr.room_id in
             and borr.room_id in
             <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
             <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
                 #{item}
                 #{item}
             </foreach>
             </foreach>
         </if>
         </if>
-        and td.table_name = 'building_owner'
-        and td.`table_columns` = 'owner_type_cd'
-        and td.status_cd = t.owner_type_cd
+        and
         <if test="sex !=null">
         <if test="sex !=null">
             and t.sex= #{sex}
             and t.sex= #{sex}
         </if>
         </if>
@@ -216,27 +207,21 @@
     <!-- 查询业主信息 add by wuxw 2018-07-03 -->
     <!-- 查询业主信息 add by wuxw 2018-07-03 -->
     <select id="getOwnerInfoCount" parameterType="Map" resultType="Map">
     <select id="getOwnerInfoCount" parameterType="Map" resultType="Map">
         select count(1) count
         select count(1) count
-        from building_owner t
-        <if test="roomId != null and roomId != ''">
-            ,building_owner_room_rel borr
-        </if>
-        <if test="roomIds != null ">
-            ,building_owner_room_rel borr
-        </if>
+        from
+        building_owner t
+        left join t_dict td on td.table_name = 'building_owner' and td.`table_columns` = 'owner_type_cd' and td.status_cd = t.owner_type_cd
+        left join building_owner_room_rel borr on and borr.status_cd = '0' and t.owner_id = borr.owner_id
         where 1 =1
         where 1 =1
         <if test="roomId != null and roomId != ''">
         <if test="roomId != null and roomId != ''">
-            and t.owner_id = borr.owner_id
-            and borr.status_cd = '0'
             and borr.room_id = #{roomId}
             and borr.room_id = #{roomId}
         </if>
         </if>
         <if test="roomIds != null">
         <if test="roomIds != null">
-            and t.owner_id = borr.owner_id
-            and borr.status_cd = '0'
             and borr.room_id in
             and borr.room_id in
             <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
             <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
                 #{item}
                 #{item}
             </foreach>
             </foreach>
         </if>
         </if>
+        and
         <if test="sex !=null">
         <if test="sex !=null">
             and t.sex= #{sex}
             and t.sex= #{sex}
         </if>
         </if>
@@ -285,6 +270,12 @@
         <if test="ownerTypeCd !=null and ownerTypeCd != ''">
         <if test="ownerTypeCd !=null and ownerTypeCd != ''">
             and t.owner_type_cd= #{ownerTypeCd}
             and t.owner_type_cd= #{ownerTypeCd}
         </if>
         </if>
+        <if test="ownerTypeCds != null">
+            and t.owner_type_cd in
+            <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
 
 
     </select>
     </select>
 
 

+ 29 - 0
service-api/src/main/java/com/java110/api/listener/owner/QueryOwnersListener.java

@@ -106,6 +106,7 @@ public class QueryOwnersListener extends AbstractServiceApiDataFlowListener {
                 }
                 }
                 ownerDtos.add(ownerDto);
                 ownerDtos.add(ownerDto);
             }
             }
+            freshRoomInfo(ownerDtos);
             apiOwnerVo.setOwners(BeanConvertUtil.covertBeanList(ownerDtos, ApiOwnerDataVo.class));
             apiOwnerVo.setOwners(BeanConvertUtil.covertBeanList(ownerDtos, ApiOwnerDataVo.class));
         }
         }
 
 
@@ -116,6 +117,34 @@ public class QueryOwnersListener extends AbstractServiceApiDataFlowListener {
         dataFlowContext.setResponseEntity(responseEntity);
         dataFlowContext.setResponseEntity(responseEntity);
     }
     }
 
 
+    private void freshRoomInfo(List<OwnerDto> ownerDtos) {
+        List<String> roomIds = new ArrayList<>();
+        for (OwnerDto ownerDto : ownerDtos) {
+            if (!StringUtil.isEmpty(ownerDto.getRoomId())) {
+                roomIds.add(ownerDto.getRoomId());
+            }
+        }
+
+        if (roomIds.size() < 1) {
+            return;
+        }
+
+        RoomDto tRoomDto = new RoomDto();
+        tRoomDto.setCommunityId(ownerDtos.get(0).getCommunityId());
+        tRoomDto.setRoomIds(roomIds.toArray(new String[roomIds.size()]));
+        List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(tRoomDto);
+
+        for (RoomDto roomDto : roomDtos) {
+            for (OwnerDto tOwnerDto : ownerDtos) {
+                if (!roomDto.getRoomId().equals(tOwnerDto.getRoomId())) {
+                    continue;
+                }
+                tOwnerDto.setRoomName(roomDto.getFloorNum() + "栋" + roomDto.getUnitNum() + "单元" + roomDto.getRoomNum());
+            }
+        }
+
+    }
+
     private void freshRoomId(JSONObject reqJson) {
     private void freshRoomId(JSONObject reqJson) {
 
 
         if (!reqJson.containsKey("roomName")) {
         if (!reqJson.containsKey("roomName")) {