Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
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
方斌
51business
Commits
f74f2f65
Commit
f74f2f65
authored
Apr 12, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addd
parent
ce7b5edb
Pipeline
#5910
passed with stage
in 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
41 deletions
+58
-41
new_house.js
app/service/house/new_house.js
+58
-41
No files found.
app/service/house/new_house.js
View file @
f74f2f65
...
@@ -99,7 +99,6 @@ class NewHouseService extends Service {
...
@@ -99,7 +99,6 @@ class NewHouseService extends Service {
orderConditions
:
[],
orderConditions
:
[],
}
}
let
newHouseImages
=
await
service
.
houseCommon
.
houseImage
.
all
(
filter
);
let
newHouseImages
=
await
service
.
houseCommon
.
houseImage
.
all
(
filter
);
ctx
.
logger
.
info
(
newHouseImages
);
let
images
=
[];
let
images
=
[];
if
(
newHouseImages
.
rowCount
>
0
)
{
if
(
newHouseImages
.
rowCount
>
0
)
{
...
@@ -113,7 +112,7 @@ class NewHouseService extends Service {
...
@@ -113,7 +112,7 @@ class NewHouseService extends Service {
}
}
}
}
//户型信息
//户型信息
let
newHouseType
=
await
this
.
getNewHouseTypeList
(
id
);
let
newHouseType
=
await
this
.
formatNewHouseTypeList
(
newHouseInfo
.
newHouseType
);
//是否关注
//是否关注
let
collectionFilter
=
{
type
:
1
,
id
:
id
}
let
collectionFilter
=
{
type
:
1
,
id
:
id
}
let
collection
=
await
service
.
house
.
collection
.
getCollection
(
collectionFilter
);
let
collection
=
await
service
.
house
.
collection
.
getCollection
(
collectionFilter
);
...
@@ -123,15 +122,48 @@ class NewHouseService extends Service {
...
@@ -123,15 +122,48 @@ class NewHouseService extends Service {
house_types
:
newHouseType
,
house_types
:
newHouseType
,
collection
:
collection
.
rowCount
>
0
?
true
:
false
,
collection
:
collection
.
rowCount
>
0
?
true
:
false
,
}
}
await
service
.
house
.
footPrint
.
addFootPrint
({
id
:
id
,
type
:
1
});
//添加用户足迹记录
return
ret
;
return
ret
;
}
}
/**
* 通过NewHouseId获取新房户型信息
* @param {*} id
*/
async
getNewHouseTypeList
(
id
)
{
const
{
ctx
,
service
}
=
this
;
let
filter
=
{
pageIndex
:
1
,
pageSize
:
999
,
queryConditions
:
[{
key
:
"state"
,
value
:
1
,
operator
:
"equal"
},
{
key
:
"newHouseId"
,
value
:
id
,
operator
:
"equal"
}],
orderConditions
:
[],
}
let
newHouseTypeList
=
await
service
.
houseCommon
.
newHouseType
.
all
(
filter
);
let
ret
=
await
formatNewHouseTypeList
(
newHouseTypeList
);
return
ret
;
}
/**
* 新房数据整理
* @param {object} data
*/
async
formatNewHouse
(
data
)
{
async
formatNewHouse
(
data
)
{
const
{
ctx
,
service
}
=
this
;
const
{
ctx
,
service
}
=
this
;
ctx
.
logger
.
info
(
data
);
const
saleType
=
{
0
:
'未开售'
,
1
:
'售罄'
,
2
:
'预售'
,
3
:
'在售'
};
const
decorationType
=
{
1
:
'毛坯'
,
2
:
'简装'
,
3
:
'精装'
}
const
archType
=
{
1
:
'板楼'
,
2
:
'塔楼'
};
let
ret
=
{};
let
ret
=
{};
if
(
Object
.
keys
(
data
).
length
>
0
)
{
if
(
Object
.
keys
(
data
).
length
>
0
)
{
let
residentialInfo
=
await
service
.
houseCommon
.
residential
.
one
(
data
.
residentialId
);
// let developerInfo = await service.houseCommon.developer.one(data.residentialId);
ret
.
basic
=
{
ret
.
basic
=
{
id
:
data
.
id
,
id
:
data
.
id
,
name
:
data
.
name
,
//标题
name
:
data
.
name
,
//标题
...
@@ -147,7 +179,7 @@ class NewHouseService extends Service {
...
@@ -147,7 +179,7 @@ class NewHouseService extends Service {
open_date
:
data
.
openDate
,
//开盘时间
open_date
:
data
.
openDate
,
//开盘时间
due_date
:
data
.
dueDate
,
//交房时间
due_date
:
data
.
dueDate
,
//交房时间
house_area
:
data
.
houseArea
,
//建筑面积
house_area
:
data
.
houseArea
,
//建筑面积
decoration
:
''
,
//装修情况
decoration
:
decorationType
[
data
.
decorationType
],
//装修情况,1 毛坯,2简装,3精装
green_ratio
:
data
.
greenRatio
,
//绿化
green_ratio
:
data
.
greenRatio
,
//绿化
area_ratio
:
data
.
areaRatio
,
//容积
area_ratio
:
data
.
areaRatio
,
//容积
address
:
data
.
address
,
//地址
address
:
data
.
address
,
//地址
...
@@ -157,31 +189,31 @@ class NewHouseService extends Service {
...
@@ -157,31 +189,31 @@ class NewHouseService extends Service {
reference_avg_price
:
data
.
referenceAvgPrice
,
//均价
reference_avg_price
:
data
.
referenceAvgPrice
,
//均价
tags
:
data
.
tags
.
split
(
','
),
//项目特色
tags
:
data
.
tags
.
split
(
','
),
//项目特色
property_type
:
''
,
//物业类型
property_type
:
''
,
//物业类型
property_right_years
:
residentialInfo
.
propertyRightYears
||
''
,
//产权年限
property_right_years
:
data
.
residential
.
propertyRightYears
,
//产权年限
build_type
:
''
,
//建筑类型
build_type
:
archType
[
data
.
residential
.
ArchType
],
//建筑类型 1 板楼 2塔楼'
decoration
:
''
,
//装修情况
decoration
:
decorationType
[
data
.
decorationType
],
//装修情况,1 毛坯,2简装,3精装
},
},
sale
:
{
sale
:
{
sale_type
:
''
,
//销售状态
sale_type
:
saleType
[
data
.
saleType
],
//销售状态 0未开售,1售罄,2预售,3在售
address
:
data
.
address
,
//地址
address
:
data
.
address
,
//地址
sale_address
:
''
,
//售楼地址
sale_address
:
data
.
saleAddress
,
//售楼地址
developer
:
''
,
//开发商
developer
:
''
,
//开发商
open_date
:
data
.
openDate
,
//开盘时间
open_date
:
data
.
openDate
,
//开盘时间
due_date
:
data
.
dueDate
,
//交房时间
due_date
:
data
.
dueDate
,
//交房时间
},
},
residential
:
{
residential
:
{
land_area
:
''
,
//占地面积
land_area
:
data
.
residential
.
landArea
,
//占地面积
house_area
:
''
,
//建筑面积
house_area
:
data
.
residential
.
houseArea
,
//建筑面积
area_ratio
:
data
.
areaRatio
,
//容积率
area_ratio
:
data
.
areaRatio
,
//容积率
green_ratio
:
data
.
greenRatio
,
//绿化率
green_ratio
:
data
.
greenRatio
,
//绿化率
property_fee
:
residentialInfo
.
PropertyFee
||
''
,
//物业费用
property_fee
:
data
.
residential
.
PropertyFee
,
//物业费用
property_company
:
residentialInfo
.
propertyCompany
||
''
,
//物业公司
property_company
:
data
.
residential
.
propertyCompany
,
//物业公司
plan_rooms
:
data
.
planRooms
,
//规划户数
plan_rooms
:
data
.
planRooms
,
//规划户数
plan_parks
:
data
.
planParks
,
//车位情况
plan_parks
:
data
.
planParks
,
//车位情况
heat_supply_type
:
residentialInfo
.
heatSupplyType
||
''
,
//供暖方式
heat_supply_type
:
data
.
residential
.
heatSupplyType
,
//供暖方式
water_supply_type
:
residentialInfo
.
waterSupplyType
||
''
,
//供水方式
water_supply_type
:
data
.
residential
.
waterSupplyType
,
//供水方式
power_supply_type
:
residentialInfo
.
powerSupplyType
||
''
,
//供电方式
power_supply_type
:
data
.
residential
.
powerSupplyType
,
//供电方式
near_by
:
residentialInfo
.
nearBy
||
''
,
//周边规划
near_by
:
data
.
residential
.
nearBy
,
//周边规划
},
},
permit
:
{
permit
:
{
pre_sale_permit
:
data
.
preSalePermit
,
//预售证
pre_sale_permit
:
data
.
preSalePermit
,
//预售证
...
@@ -194,32 +226,17 @@ class NewHouseService extends Service {
...
@@ -194,32 +226,17 @@ class NewHouseService extends Service {
}
}
/**
/**
*
通过NewHouseId获取新房户型信息
*
对newHouseTypeList格式化
* @param {
*} id
* @param {
object} newHouseTypeList
*/
*/
async
getNewHouseTypeList
(
id
)
{
async
formatNewHouseTypeList
(
newHouseTypeList
)
{
const
{
ctx
,
service
}
=
this
;
const
{
ctx
,
service
}
=
this
;
let
filter
=
{
pageIndex
:
1
,
pageSize
:
999
,
queryConditions
:
[{
key
:
"state"
,
value
:
1
,
operator
:
"equal"
},
{
key
:
"newHouseId"
,
value
:
id
,
operator
:
"equal"
}],
orderConditions
:
[],
}
let
newHouseTypeList
=
await
service
.
houseCommon
.
newHouseType
.
all
(
filter
);
//数据格式化
//数据格式化
let
retList
=
[];
let
retList
=
[];
if
(
newHouseTypeList
.
rowCount
>
0
)
{
if
(
newHouseTypeList
.
length
>
0
)
{
let
taskList
=
[];
let
taskList
=
[];
for
(
let
i
in
newHouseTypeList
.
results
)
{
for
(
let
i
in
newHouseTypeList
)
{
taskList
[
i
]
=
this
.
formatNewHouseType
(
newHouseTypeList
.
results
[
i
]);
taskList
[
i
]
=
this
.
formatNewHouseType
(
newHouseTypeList
[
i
]);
}
}
retList
=
await
Promise
.
all
(
taskList
).
then
(
result
=>
{
retList
=
await
Promise
.
all
(
taskList
).
then
(
result
=>
{
...
@@ -228,7 +245,6 @@ class NewHouseService extends Service {
...
@@ -228,7 +245,6 @@ class NewHouseService extends Service {
ctx
.
failed
(
error
);
ctx
.
failed
(
error
);
});
});
}
}
//将楼盘的户型按照户型分组
//将楼盘的户型按照户型分组
let
typeFormat
=
{};
let
typeFormat
=
{};
for
(
let
i
in
retList
)
{
for
(
let
i
in
retList
)
{
...
@@ -265,6 +281,7 @@ class NewHouseService extends Service {
...
@@ -265,6 +281,7 @@ class NewHouseService extends Service {
*/
*/
async
formatNewHouseType
(
data
)
{
async
formatNewHouseType
(
data
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
saleType
=
{
0
:
'未开售'
,
1
:
'售罄'
,
2
:
'预售'
,
3
:
'在售'
};
let
ret
=
{};
let
ret
=
{};
if
(
Object
.
keys
(
data
).
length
>
0
)
{
if
(
Object
.
keys
(
data
).
length
>
0
)
{
ret
=
{
ret
=
{
...
@@ -274,7 +291,7 @@ class NewHouseService extends Service {
...
@@ -274,7 +291,7 @@ class NewHouseService extends Service {
image
:
data
.
image
,
image
:
data
.
image
,
house_type
:
data
.
houseType
,
//住宅类型,如住宅,公寓
house_type
:
data
.
houseType
,
//住宅类型,如住宅,公寓
apartment
:
data
.
apartment
,
//户型,如4室2厅3卫
apartment
:
data
.
apartment
,
//户型,如4室2厅3卫
sale_type
:
data
.
saleType
,
//销售类型,0未开售,1预售,2在售,3售罄
sale_type
:
saleType
[
data
.
saleType
],
area
:
data
.
area
,
//面积
area
:
data
.
area
,
//面积
orientation
:
data
.
orientation
,
//朝向
orientation
:
data
.
orientation
,
//朝向
num
:
data
.
num
,
//房源数量
num
:
data
.
num
,
//房源数量
...
...
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