springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/RentingHousesApi.java
@@ -162,6 +162,10 @@ @ApiOperation(value = "附近的房源",response =RentingHouseRegisterVO.class) @PostMapping("/nearby") public R nearby(@RequestBody NearbyDTO nearbyDTO){ LoginUserInfoVO loginUserInfoSureNoLogin = getLoginUserInfoSureNoLogin(); if (Objects.nonNull(loginUserInfoSureNoLogin)) { nearbyDTO.setCommunityId(loginUserInfoSureNoLogin.getCommunityId()); } return communityService.nearby(nearbyDTO); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/rentingHouses/NearbyDTO.java
@@ -18,4 +18,6 @@ private Integer distance; @ApiModelProperty("关键字") private String keyword; @ApiModelProperty("社区id") private Long communityId; } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/RentingHourseRegisterDao.java
@@ -35,9 +35,11 @@ * @param minY * @param maxY * @param keyword * @param communityId * @return */ List<RentingHouseRegisterVO> nearby(@Param("minX") Double minX,@Param("maxX") Double maxX,@Param("minY")Double minY,@Param("maxY")Double maxY,@Param("keyword")String keyword); List<RentingHouseRegisterVO> nearby(@Param("minX") Double minX, @Param("maxX") Double maxX, @Param("minY") Double minY, @Param("maxY") Double maxY, @Param("keyword") String keyword, @Param("communityId") Long communityId); /** * 分页获取房源信息 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/RentingHourseRegisterServiceImpl.java
@@ -13,6 +13,7 @@ import javax.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -124,6 +125,7 @@ List<String> housePictures = registerDTO.getHousePictures(); if (!housePictures.isEmpty()) { housePictures.forEach(e -> { if (StringUtils.isNotBlank(e)) { RentingHourseFile file = new RentingHourseFile(); file.setId(Snowflake.getId()); file.setClassification(RentingHourseFile.Classification.fytp); @@ -133,11 +135,13 @@ file.setCreateBy(userId); file.setCreateAt(nowDate); files.add(file); } }); } List<String> propertyPictures = registerDTO.getPropertyPictures(); if (!propertyPictures.isEmpty()) { propertyPictures.forEach(e -> { if (StringUtils.isNotBlank(e)) { RentingHourseFile file = new RentingHourseFile(); file.setId(Snowflake.getId()); file.setClassification(RentingHourseFile.Classification.cqtp); @@ -147,11 +151,13 @@ file.setCreateBy(userId); file.setCreateAt(nowDate); files.add(file); } }); } List<String> credentialsPictures = registerDTO.getCredentialsPictures(); if (!credentialsPictures.isEmpty()) { credentialsPictures.forEach(e -> { if (StringUtils.isNotBlank(e)) { RentingHourseFile file = new RentingHourseFile(); file.setId(Snowflake.getId()); file.setClassification(RentingHourseFile.Classification.zjzq); @@ -161,6 +167,7 @@ file.setCreateBy(userId); file.setCreateAt(nowDate); files.add(file); } }); } rentingHourseFileService.saveBatch(files); @@ -218,6 +225,7 @@ .eq(RentingHourseFile::getClassification, RentingHourseFile.Classification.fytp) .eq(RentingHourseFile::getType, RentingHourseFile.Type.picture)); housePictures.forEach(e -> { if (StringUtils.isNotBlank(e)) { RentingHourseFile file = new RentingHourseFile(); file.setId(Snowflake.getId()); file.setClassification(RentingHourseFile.Classification.fytp); @@ -227,6 +235,7 @@ file.setCreateBy(userId); file.setCreateAt(nowDate); files.add(file); } }); } List<String> propertyPictures = registerDTO.getPropertyPictures(); @@ -236,6 +245,7 @@ .eq(RentingHourseFile::getClassification, RentingHourseFile.Classification.cqtp) .eq(RentingHourseFile::getType, RentingHourseFile.Type.picture)); propertyPictures.forEach(e -> { if (StringUtils.isNotBlank(e)) { RentingHourseFile file = new RentingHourseFile(); file.setId(Snowflake.getId()); file.setClassification(RentingHourseFile.Classification.cqtp); @@ -245,6 +255,7 @@ file.setCreateBy(userId); file.setCreateAt(nowDate); files.add(file); } }); } List<String> credentialsPictures = registerDTO.getCredentialsPictures(); @@ -254,6 +265,7 @@ .eq(RentingHourseFile::getClassification, RentingHourseFile.Classification.zjzq) .eq(RentingHourseFile::getType, RentingHourseFile.Type.picture)); credentialsPictures.forEach(e -> { if (StringUtils.isNotBlank(e)) { RentingHourseFile file = new RentingHourseFile(); file.setId(Snowflake.getId()); file.setClassification(RentingHourseFile.Classification.zjzq); @@ -263,6 +275,7 @@ file.setCreateBy(userId); file.setCreateAt(nowDate); files.add(file); } }); } rentingHourseFileService.saveBatch(files); @@ -398,7 +411,8 @@ @Override public R nearby(NearbyDTO nearbyDTO) { Rectangle rectangle =new NearbyUtil().getRectangle(nearbyDTO.getDistance(), Double.parseDouble(nearbyDTO.getLongitude()), Double.parseDouble(nearbyDTO.getLatitude())); return R.ok(this.baseMapper.nearby(rectangle.getMinX(),rectangle.getMaxX(),rectangle.getMinY(),rectangle.getMaxY(),nearbyDTO.getKeyword())); return R.ok(this.baseMapper.nearby(rectangle.getMinX(),rectangle.getMaxX(), rectangle.getMinY(),rectangle.getMaxY(),nearbyDTO.getKeyword(), nearbyDTO.getCommunityId())); } @Override springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/RentingHourseRegisterMapper.xml
@@ -101,8 +101,10 @@ <select id="nearby" resultType="com.panzhihua.common.model.vos.community.rentingHouses.RentingHouseRegisterVO"> select t.id,title, brn, construct_area, floor, orientation, decoration, label, address, monthly_rent_money, `status`, detail_status, auth_status,t1.url from renting_hourse_register t left join renting_hourse_file t1 on t.id = t1.ref_id WHERE 1=1 and t.status=2 and t.detail_status=3 `status`, detail_status, auth_status,t1.url from renting_hourse_register t LEFT JOIN (SELECT * FROM renting_hourse_file WHERE classification = 1 AND `type` = 1) t1 ON t.id = t1.ref_id WHERE t.community_id = #{communityId} and t.status=2 and t.detail_status=3 <if test="keyword !=null and keyword!=''"> AND ( village_name LIKE CONCAT('%', #{keyword}, '%') @@ -110,7 +112,7 @@ ) </if> and (longitude BETWEEN ${minX} AND ${maxX}) and (latitude BETWEEN ${minY} AND ${maxY}) and t1.type = 1 group by t.id and (latitude BETWEEN ${minY} AND ${maxY}) group by t.id </select> <select id="pageRentingHouseApplet" @@ -120,7 +122,8 @@ <if test="pageRegisterDTO.longitude !=null and pageRegisterDTO.longitude !=''"> ,(POWER(MOD(ABS(longitude - #{pageRegisterDTO.longitude}),360),2) + POWER(ABS(latitude - #{pageRegisterDTO.latitude}),2)) AS distance </if> FROM renting_hourse_register t left join renting_hourse_file t1 on t.id = t1.ref_id FROM renting_hourse_register t LEFT JOIN (SELECT * FROM renting_hourse_file WHERE classification = 1 AND `type` = 1) t1 ON t.id = t1.ref_id LEFT JOIN sys_user t2 ON t.tenant_user_id = t2.user_id WHERE t.community_id = #{pageRegisterDTO.communityId} <if test="pageRegisterDTO.status == null">