Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yichengstreet-be
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yichengstreet
yichengstreet-be
Commits
c8921587
You need to sign in or sign up before continuing.
Commit
c8921587
authored
Jul 31, 2025
by
lixuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 房源
parent
a20733e8
Pipeline
#145561
canceled with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
37 deletions
+82
-37
GridRegionMapper.java
...n/java/com/ruoyi/system/mapper/grid/GridRegionMapper.java
+4
-0
HouseResourceServiceImpl.java
...i/system/service/house/impl/HouseResourceServiceImpl.java
+67
-35
GridRegionMapper.xml
...ystem/src/main/resources/mapper/grid/GridRegionMapper.xml
+9
-1
HouseResourceMapper.xml
...m/src/main/resources/mapper/house/HouseResourceMapper.xml
+2
-1
No files found.
ruoyi-system/src/main/java/com/ruoyi/system/mapper/grid/GridRegionMapper.java
View file @
c8921587
...
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Param;
...
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Param;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
public
interface
GridRegionMapper
{
public
interface
GridRegionMapper
{
long
countByExample
(
GridRegionExample
example
);
long
countByExample
(
GridRegionExample
example
);
...
@@ -98,4 +100,6 @@ public interface GridRegionMapper {
...
@@ -98,4 +100,6 @@ public interface GridRegionMapper {
GridRegion
selectByWgName
(
@Param
(
"wgName"
)
String
wgName
);
GridRegion
selectByWgName
(
@Param
(
"wgName"
)
String
wgName
);
List
<
GridRegion
>
getAllLevelThree
(
@Param
(
"wgCodeLikes"
)
List
<
String
>
wgCodeLikes
,
@Param
(
"wgType"
)
String
wgType
,
@Param
(
"name"
)
String
name
);
List
<
GridRegion
>
getAllLevelThree
(
@Param
(
"wgCodeLikes"
)
List
<
String
>
wgCodeLikes
,
@Param
(
"wgType"
)
String
wgType
,
@Param
(
"name"
)
String
name
);
List
<
GridRegion
>
selectByCodes
(
@Param
(
"codes"
)
Set
<
String
>
codes
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/house/impl/HouseResourceServiceImpl.java
View file @
c8921587
...
@@ -28,11 +28,16 @@ import org.springframework.util.StringUtils;
...
@@ -28,11 +28,16 @@ import org.springframework.util.StringUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
HouseResourceServiceImpl
implements
HouseResourceService
{
public
class
HouseResourceServiceImpl
implements
HouseResourceService
{
private
static
final
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
Runtime
.
getRuntime
().
availableProcessors
()
*
2
);
private
final
HouseResourceMapper
houseResourceMapper
;
private
final
HouseResourceMapper
houseResourceMapper
;
private
final
BusinessEntityInfoMapper
businessEntityInfoMapper
;
private
final
BusinessEntityInfoMapper
businessEntityInfoMapper
;
...
@@ -411,7 +416,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
...
@@ -411,7 +416,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
businessEntityStatisticsDetail
.
setXsCount
(
list
.
stream
().
map
(
HouseResourcePage:
:
getIncome
).
filter
(
Objects:
:
nonNull
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
businessEntityStatisticsDetail
.
setXsCount
(
list
.
stream
().
map
(
HouseResourcePage:
:
getIncome
).
filter
(
Objects:
:
nonNull
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
businessEntityStatisticsDetail
.
setSsCount
(
list
.
stream
().
map
(
HouseResourcePage:
:
getTaxCount
).
filter
(
Objects:
:
nonNull
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
businessEntityStatisticsDetail
.
setSsCount
(
list
.
stream
().
map
(
HouseResourcePage:
:
getTaxCount
).
filter
(
Objects:
:
nonNull
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
businessEntityStatisticsDetail
.
setGsCount
(
list
.
stream
().
filter
(
x
->
x
.
getGs
().
equals
(
Boolean
.
TRUE
)).
count
());
businessEntityStatisticsDetail
.
setGsCount
(
list
.
stream
().
filter
(
x
->
Objects
.
nonNull
(
x
.
getGs
())).
filter
(
x
->
x
.
getGs
().
equals
(
Boolean
.
TRUE
)).
count
());
List
<
String
>
houseResourceIds
=
list
.
stream
().
map
(
HouseResourcePage:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
String
>
houseResourceIds
=
list
.
stream
().
map
(
HouseResourcePage:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
HouseResourceBusinessEntityInfoMapping
>
houseResourceMappings
=
houseResourceBusinessEntityInfoMappingMapper
.
selectByHouseResourceIds
(
houseResourceIds
);
List
<
HouseResourceBusinessEntityInfoMapping
>
houseResourceMappings
=
houseResourceBusinessEntityInfoMappingMapper
.
selectByHouseResourceIds
(
houseResourceIds
);
...
@@ -547,45 +552,72 @@ public class HouseResourceServiceImpl implements HouseResourceService {
...
@@ -547,45 +552,72 @@ public class HouseResourceServiceImpl implements HouseResourceService {
}
}
private
List
<
HouseResourcePage
>
handleHouseList
(
List
<
HouseResourcePage
>
list
,
boolean
houseNumberSortFlag
)
{
private
List
<
HouseResourcePage
>
handleHouseList
(
List
<
HouseResourcePage
>
list
,
boolean
houseNumberSortFlag
)
{
list
.
parallelStream
().
forEach
(
x
->
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
GridRegionExample
twoExample
=
new
GridRegionExample
();
return
Collections
.
emptyList
();
twoExample
.
createCriteria
().
andWgTypeEqualTo
(
String
.
valueOf
(
x
.
getType
())).
andWgCodeEqualTo
(
x
.
getTwo
());
}
List
<
GridRegion
>
two
=
gridRegionMapper
.
selectByExample
(
twoExample
);
if
(!
CollectionUtils
.
isEmpty
(
two
))
{
CompletableFuture
<
Set
<
String
>>
twoCodesFuture
=
CompletableFuture
.
supplyAsync
(()
->
list
.
stream
().
map
(
HouseResourcePage:
:
getTwo
).
collect
(
Collectors
.
toSet
()),
executor
);
x
.
setWgName2
(
two
.
get
(
0
).
getWgName
());
CompletableFuture
<
Set
<
String
>>
threeCodesFuture
=
CompletableFuture
.
supplyAsync
(()
->
list
.
stream
().
map
(
HouseResourcePage:
:
getThree
).
collect
(
Collectors
.
toSet
()),
executor
);
}
CompletableFuture
<
Set
<
String
>>
fourCodesFuture
=
CompletableFuture
.
supplyAsync
(()
->
list
.
stream
().
map
(
HouseResourcePage:
:
getFour
).
collect
(
Collectors
.
toSet
()),
executor
);
GridRegionExample
threeExample
=
new
GridRegionExample
();
CompletableFuture
<
List
<
String
>>
idsFuture
=
CompletableFuture
.
supplyAsync
(()
->
list
.
stream
().
map
(
HouseResourcePage:
:
getId
).
collect
(
Collectors
.
toList
()),
executor
);
threeExample
.
createCriteria
().
andWgTypeEqualTo
(
String
.
valueOf
(
x
.
getType
())).
andWgCodeEqualTo
(
x
.
getThree
());
List
<
GridRegion
>
three
=
gridRegionMapper
.
selectByExample
(
threeExample
);
Set
<
String
>
twoCodes
=
twoCodesFuture
.
join
();
if
(!
CollectionUtils
.
isEmpty
(
three
))
{
Set
<
String
>
threeCodes
=
threeCodesFuture
.
join
();
x
.
setWgName3
(
three
.
get
(
0
).
getWgName
());
Set
<
String
>
fourCodes
=
fourCodesFuture
.
join
();
}
List
<
String
>
ids
=
idsFuture
.
join
();
if
(!
StringUtils
.
hasText
(
x
.
getWgName4
()))
{
GridRegionExample
fourExample
=
new
GridRegionExample
();
fourExample
.
createCriteria
().
andWgTypeEqualTo
(
String
.
valueOf
(
x
.
getType
())).
andWgCodeEqualTo
(
x
.
getFour
());
CompletableFuture
<
Map
<
String
,
GridRegion
>>
twoMapFuture
=
CompletableFuture
.
supplyAsync
(()
->
gridRegionMapper
.
selectByCodes
(
twoCodes
).
stream
().
collect
(
Collectors
.
toMap
(
GridRegion:
:
getWgCode
,
gridRegion
->
gridRegion
,
(
e
,
r
)
->
e
)),
executor
);
List
<
GridRegion
>
four
=
gridRegionMapper
.
selectByExample
(
fourExample
);
CompletableFuture
<
Map
<
String
,
GridRegion
>>
threeMapFuture
=
CompletableFuture
.
supplyAsync
(()
->
gridRegionMapper
.
selectByCodes
(
threeCodes
).
stream
().
collect
(
Collectors
.
toMap
(
GridRegion:
:
getWgCode
,
gridRegion
->
gridRegion
,
(
e
,
r
)
->
e
)),
executor
);
if
(!
CollectionUtils
.
isEmpty
(
four
))
{
CompletableFuture
<
Map
<
String
,
GridRegion
>>
fourMapFuture
=
CompletableFuture
.
supplyAsync
(()
->
gridRegionMapper
.
selectByCodes
(
fourCodes
).
stream
().
collect
(
Collectors
.
toMap
(
GridRegion:
:
getWgCode
,
gridRegion
->
gridRegion
,
(
e
,
r
)
->
e
)),
executor
);
x
.
setWgName4
(
four
.
get
(
0
).
getWgName
());
CompletableFuture
<
Map
<
String
,
List
<
HouseResourceBusinessEntityInfoMapping
>>>
mappingMapFuture
=
CompletableFuture
.
supplyAsync
(()
->
houseResourceBusinessEntityInfoMappingMapper
.
selectByHouseResourceIds
(
ids
).
stream
().
collect
(
Collectors
.
groupingBy
(
HouseResourceBusinessEntityInfoMapping:
:
getHouseResourceId
)),
executor
);
}
Map
<
String
,
GridRegion
>
twoMap
=
twoMapFuture
.
join
();
Map
<
String
,
GridRegion
>
threeMap
=
threeMapFuture
.
join
();
Map
<
String
,
GridRegion
>
fourMap
=
fourMapFuture
.
join
();
Map
<
String
,
List
<
HouseResourceBusinessEntityInfoMapping
>>
mappingMap
=
mappingMapFuture
.
join
();
List
<
String
>
entityInfoIds
=
mappingMap
.
values
().
stream
()
.
flatMap
(
List:
:
stream
)
.
map
(
HouseResourceBusinessEntityInfoMapping:
:
getBusinessEntityInfoId
)
.
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
BusinessEntityInfo
>>
entityInfoMap
=
businessEntityInfoMapper
.
selectByIdList
(
entityInfoIds
)
.
stream
().
collect
(
Collectors
.
groupingBy
(
BusinessEntityInfo:
:
getId
));
List
<
HouseResourcePage
>
result
=
list
.
parallelStream
().
map
(
x
->
{
HouseResourcePage
page
=
new
HouseResourcePage
();
BeanUtils
.
copyProperties
(
x
,
page
);
GridRegion
two
=
twoMap
.
get
(
page
.
getTwo
());
if
(
two
!=
null
)
page
.
setWgName2
(
two
.
getWgName
());
GridRegion
three
=
threeMap
.
get
(
page
.
getThree
());
if
(
three
!=
null
)
page
.
setWgName3
(
three
.
getWgName
());
if
(!
StringUtils
.
hasText
(
page
.
getWgName4
()))
{
GridRegion
four
=
fourMap
.
get
(
page
.
getFour
());
if
(
four
!=
null
)
page
.
setWgName4
(
four
.
getWgName
());
}
}
x
.
setHouseResourceAttributeText
(
HouseEnums
.
HouseResourceAttributeEnum
.
getDescByCode
(
x
.
getHouseResourceAttribute
()));
page
.
setHouseResourceAttributeText
(
HouseEnums
.
HouseResourceAttributeEnum
.
getDescByCode
(
page
.
getHouseResourceAttribute
()));
x
.
setHouseResourceTypeText
(
HouseEnums
.
HouseResourceTypeEnum
.
getDescByCode
(
x
.
getHouseResourceType
()));
page
.
setHouseResourceTypeText
(
HouseEnums
.
HouseResourceTypeEnum
.
getDescByCode
(
page
.
getHouseResourceType
()));
x
.
setOrientationText
(
HouseEnums
.
OrientationEnum
.
getDescByCode
(
x
.
getOrientation
()));
page
.
setOrientationText
(
HouseEnums
.
OrientationEnum
.
getDescByCode
(
page
.
getOrientation
()));
x
.
setDecorationConditionText
(
HouseEnums
.
DecorationConditionEnum
.
getDescByCode
(
x
.
getDecorationCondition
()));
page
.
setDecorationConditionText
(
HouseEnums
.
DecorationConditionEnum
.
getDescByCode
(
page
.
getDecorationCondition
()));
x
.
setRentalUnitText
(
HouseEnums
.
RentalUnitEnum
.
getDescByCode
(
x
.
getRentalUnit
()));
page
.
setRentalUnitText
(
HouseEnums
.
RentalUnitEnum
.
getDescByCode
(
page
.
getRentalUnit
()));
x
.
setHireStatusText
(
HouseEnums
.
hireStatusTextEnum
.
getDescByCode
(
x
.
getHireStatus
()));
page
.
setHireStatusText
(
HouseEnums
.
hireStatusTextEnum
.
getDescByCode
(
page
.
getHireStatus
()));
List
<
HouseResourceBusinessEntityInfoMapping
>
houseResourceBusinessEntityInfoMappings
=
houseResourceBusinessEntityInfoMappingMapper
.
selectByHouseResourceId
(
x
.
getId
());
List
<
HouseResourceBusinessEntityInfoMapping
>
mappings
=
mappingMap
.
get
(
page
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
houseResourceBusinessEntityInfoMappings
))
{
if
(!
CollectionUtils
.
isEmpty
(
mappings
))
{
List
<
BusinessEntityInfo
>
businessEntityInfos
=
businessEntityInfoMapper
.
selectByIdList
(
houseResourceBusinessEntityInfoMappings
.
stream
().
map
(
HouseResourceBusinessEntityInfoMapping:
:
getBusinessEntityInfoId
).
collect
(
Collectors
.
toList
()));
List
<
String
>
entityIds
=
mappings
.
stream
().
map
(
HouseResourceBusinessEntityInfoMapping:
:
getBusinessEntityInfoId
).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
businessEntityInfos
))
{
List
<
BusinessEntityInfo
>
infos
=
entityIds
.
stream
().
map
(
entityInfoMap:
:
get
).
filter
(
Objects:
:
nonNull
).
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toList
());
x
.
setBusinessEntityInfoNames
(
businessEntityInfos
.
stream
().
map
(
BusinessEntityInfo:
:
getName
).
collect
(
Collectors
.
toList
()));
if
(!
CollectionUtils
.
isEmpty
(
infos
))
{
page
.
setBusinessEntityInfoNames
(
infos
.
stream
().
map
(
BusinessEntityInfo:
:
getName
).
collect
(
Collectors
.
toList
()));
}
}
}
}
});
return
page
;
}).
collect
(
Collectors
.
toList
());
if
(
houseNumberSortFlag
)
{
if
(
houseNumberSortFlag
)
{
return
lis
t
.
stream
().
sorted
(
Comparator
.
comparing
(
HouseResourcePage:
:
getHouseNumber
,
Comparator
.
nullsLast
(
String:
:
compareTo
))).
collect
(
Collectors
.
toList
());
return
resul
t
.
stream
().
sorted
(
Comparator
.
comparing
(
HouseResourcePage:
:
getHouseNumber
,
Comparator
.
nullsLast
(
String:
:
compareTo
))).
collect
(
Collectors
.
toList
());
}
else
{
}
else
{
return
lis
t
;
return
resul
t
;
}
}
}
}
...
...
ruoyi-system/src/main/resources/mapper/grid/GridRegionMapper.xml
View file @
c8921587
...
@@ -818,5 +818,13 @@
...
@@ -818,5 +818,13 @@
and level = 3
and level = 3
order by position asc
order by position asc
</select>
</select>
<select
id=
"selectByCodes"
resultType=
"com.ruoyi.system.domain.grid.GridRegion"
>
SELECT *
FROM grid_region
WHERE is_valid = '1'
AND wg_code IN
<foreach
collection=
"codes"
item=
"code"
open=
"("
separator=
","
close=
")"
>
#{code}
</foreach>
</select>
</mapper>
</mapper>
ruoyi-system/src/main/resources/mapper/house/HouseResourceMapper.xml
View file @
c8921587
...
@@ -296,7 +296,8 @@
...
@@ -296,7 +296,8 @@
t4.industry_classification,
t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t4.name,
t4.name,
t5.year
t5.year,
t4.gs
FROM
FROM
house_resource t1
house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment