Browse Source

优化 房屋出租记录

java110 5 years ago
parent
commit
a92d32bc8b

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

@@ -47,6 +47,8 @@ public class OwnerDto extends PageDto implements Serializable {
     private String floorId;
     private String unitId;
     private String state;
+    private String startTime;
+    private String endTime;
 
     private String bId;
 
@@ -295,4 +297,20 @@ public class OwnerDto extends PageDto implements Serializable {
     public void setRoomName(String roomName) {
         this.roomName = roomName;
     }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
 }

+ 32 - 1
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml

@@ -498,7 +498,7 @@
     <!-- 查询未入驻业主 总数 -->
     <select id="queryNoEnterRoomOwnerCount" parameterType="Map" resultType="Map">
         select
-            COUNT(1) count
+        COUNT(1) count
         from
         building_owner o
         left join building_owner_room_rel orr on o.owner_id = orr.owner_id and orr.status_cd = '0'
@@ -561,5 +561,36 @@
 
     </select>
 
+    <select id="queryOwnerLogsByRoom" parameterType="Map" resultType="Map">
+        SELECT
+        bo.owner_id ownerId,
+        bo.`name`,
+        bo.link,
+        t.start_time startTime,
+        t.end_time endTime,
+        t.create_time createTime,
+        t.room_id roomId
+        FROM
+        business_building_owner_room_rel t
+        INNER JOIN building_owner bo ON t.owner_id = bo.owner_id AND bo.status_cd = '0' AND bo.community_id = #{communityId}
+        WHERE
+        t.operate = 'ADD'
+        AND t.room_id = #{roomId}
+        ORDER BY
+        t.create_time DESC
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
+    <select id="queryOwnerLogsCountByRoom" parameterType="Map" resultType="Map">
+        select
+        COUNT(1) count
+        from business_building_owner_room_rel t
+        inner join building_owner bo on t.owner_id = bo.owner_id and bo.status_cd = '0' and bo.community_id = #{communityId}
+        where t.operate = 'ADD'
+        and t.room_id = #{roomId}
+        order by t.create_time desc
+    </select>
 
 </mapper>

+ 15 - 0
java110-interface/src/main/java/com/java110/intf/user/IOwnerInnerServiceSMO.java

@@ -109,4 +109,19 @@ public interface IOwnerInnerServiceSMO {
     @RequestMapping(value = "/updateOwnerMember", method = RequestMethod.POST)
     int updateOwnerMember(@RequestBody OwnerPo ownerPo);
 
+    /**
+     * 查询 商铺租房记录 数量
+     * @param ownerDto
+     * @return
+     */
+    @RequestMapping(value = "/queryOwnerLogsCountByRoom", method = RequestMethod.POST)
+    int queryOwnerLogsCountByRoom(@RequestBody OwnerDto ownerDto);
+
+    /**
+     * 查询 商铺租房记录
+     * @param ownerDto
+     * @return
+     */
+    @RequestMapping(value = "/queryOwnerLogsByRoom", method = RequestMethod.POST)
+    List<OwnerDto> queryOwnerLogsByRoom(@RequestBody OwnerDto ownerDto);
 }

+ 27 - 5
service-user/src/main/java/com/java110/user/api/OwnerApi.java

@@ -1,11 +1,9 @@
 package com.java110.user.api;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.po.owner.OwnerPo;
-import com.java110.user.bmo.owner.IChangeOwnerPhone;
-import com.java110.user.bmo.owner.IComprehensiveQuery;
-import com.java110.user.bmo.owner.IQueryTenants;
-import com.java110.user.bmo.owner.IVisitorRecord;
+import com.java110.user.bmo.owner.*;
 import com.java110.utils.util.Assert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -28,6 +26,9 @@ public class OwnerApi {
     @Autowired
     private IComprehensiveQuery comprehensiveQueryImpl;
 
+    @Autowired
+    private IQueryShopsHireLog queryShopsHireLogImpl;
+
     @RequestMapping(value = "/tenants")
     public ResponseEntity<String> tenants(@RequestBody JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "code", "小区编码不能为空");
@@ -76,6 +77,27 @@ public class OwnerApi {
                                                      @RequestParam(value = "searchValue") String searchValue,
                                                      @RequestParam(value = "searchType") String searchType,
                                                      @RequestHeader(value = "user-id") String userId) {
-        return comprehensiveQueryImpl.query(communityId, searchValue, searchType,userId);
+        return comprehensiveQueryImpl.query(communityId, searchValue, searchType, userId);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param communityId 小区ID
+     * @return
+     * @serviceCode /ownerApi/queryShopsHireLog
+     * @path /app/ownerApi/queryShopsHireLog
+     */
+    @RequestMapping(value = "/queryShopsHireLog", method = RequestMethod.GET)
+    public ResponseEntity<String> queryShopsHireLog(@RequestParam(value = "communityId") String communityId,
+                                                    @RequestParam(value = "roomId") String roomId,
+                                                    @RequestParam(value = "page") int page,
+                                                    @RequestParam(value = "row") int row) {
+        OwnerDto ownerDto = new OwnerDto();
+        ownerDto.setPage(page);
+        ownerDto.setRow(row);
+        ownerDto.setCommunityId(communityId);
+        ownerDto.setRoomId(roomId);
+        return queryShopsHireLogImpl.query(ownerDto);
     }
 }

+ 33 - 0
service-user/src/main/java/com/java110/user/bmo/owner/IQueryShopsHireLog.java

@@ -0,0 +1,33 @@
+package com.java110.user.bmo.owner;/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.java110.dto.owner.OwnerDto;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 查询商铺出租日志记录
+ * <p>
+ * add by 吴学文 2021-01-13
+ */
+public interface IQueryShopsHireLog {
+
+    /**
+     * 商铺出租查询
+     *
+     * @return
+     */
+    ResponseEntity<String> query(OwnerDto ownerDto);
+}

+ 39 - 0
service-user/src/main/java/com/java110/user/bmo/owner/impl/QueryShopsHireLogImpl.java

@@ -0,0 +1,39 @@
+package com.java110.user.bmo.owner.impl;
+
+import com.java110.dto.owner.OwnerDto;
+import com.java110.intf.user.IOwnerInnerServiceSMO;
+import com.java110.user.bmo.owner.IQueryShopsHireLog;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class QueryShopsHireLogImpl implements IQueryShopsHireLog {
+
+    @Autowired
+    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+
+    @Override
+    public ResponseEntity<String> query(OwnerDto ownerDto) {
+
+        int count = ownerInnerServiceSMOImpl.queryOwnerLogsCountByRoom(ownerDto);
+
+        List<OwnerDto> ownerDtos = null;
+        if (count > 0) {
+            ownerDtos = ownerInnerServiceSMOImpl.queryOwnerLogsByRoom(ownerDto);
+        } else {
+            ownerDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) ownerDto.getRow()), count, ownerDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        return responseEntity;
+    }
+}

+ 3 - 0
service-user/src/main/java/com/java110/user/dao/IOwnerServiceDao.java

@@ -123,4 +123,7 @@ public interface IOwnerServiceDao {
      */
     List<Map> queryOwnersByParkingSpace(Map info) throws DAOException;
 
+    int queryOwnerLogsCountByRoom(Map info);
+
+    List<Map> queryOwnerLogsByRoom(Map info);
 }

+ 25 - 4
service-user/src/main/java/com/java110/user/dao/impl/OwnerServiceDaoImpl.java

@@ -1,11 +1,11 @@
 package com.java110.user.dao.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IOwnerServiceDao;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.DAOException;
 import com.java110.utils.util.DateUtil;
-import com.java110.core.base.dao.BaseServiceDao;
-import com.java110.user.dao.IOwnerServiceDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -113,7 +113,6 @@ public class OwnerServiceDaoImpl extends BaseServiceDao implements IOwnerService
     }
 
 
-
     /**
      * 修改业主信息
      *
@@ -210,7 +209,29 @@ public class OwnerServiceDaoImpl extends BaseServiceDao implements IOwnerService
 
         List<Map> businessOwnerInfos = sqlSessionTemplate.selectList("ownerServiceDaoImpl.queryOwnersByParkingSpace", info);
 
-        return businessOwnerInfos;    }
+        return businessOwnerInfos;
+    }
+
+    @Override
+    public int queryOwnerLogsCountByRoom(Map info) {
+        logger.debug("查询业主数据 入参 info : {}", info);
+
+        List<Map> businessOwnerInfos = sqlSessionTemplate.selectList("ownerServiceDaoImpl.queryOwnerLogsCountByRoom", info);
+        if (businessOwnerInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerInfos.get(0).get("count").toString());
+    }
+
+    @Override
+    public List<Map> queryOwnerLogsByRoom(Map info) {
+        logger.debug("queryOwnerLogsByRoom 入参 info : {}", info);
+
+        List<Map> businessOwnerInfos = sqlSessionTemplate.selectList("ownerServiceDaoImpl.queryOwnerLogsByRoom", info);
+
+        return businessOwnerInfos;
+    }
 
 
 }

+ 10 - 0
service-user/src/main/java/com/java110/user/smo/impl/OwnerInnerServiceSMOImpl.java

@@ -273,6 +273,16 @@ public class OwnerInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerIn
         return 1;
     }
 
+    @Override
+    public int queryOwnerLogsCountByRoom(@RequestBody OwnerDto ownerDto) {
+        return ownerServiceDaoImpl.queryOwnerLogsCountByRoom(BeanConvertUtil.beanCovertMap(ownerDto));
+    }
+
+    @Override
+    public List<OwnerDto> queryOwnerLogsByRoom(@RequestBody OwnerDto ownerDto) {
+        return BeanConvertUtil.covertBeanList(ownerServiceDaoImpl.queryOwnerLogsByRoom(BeanConvertUtil.beanCovertMap(ownerDto)), OwnerDto.class);
+    }
+
     public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
         return userInnerServiceSMOImpl;
     }