feature (办公基价迁移): 完成办公计价迁移
1. 办公案例下载 2. 办公案例清洗 3. 办公基价计算 4. 办公基价导入 5. 物业基价菜单调整 6. 住宅租赁挂牌案例下载 7. 住宅租赁案例清洗
This commit is contained in:
@ -49,7 +49,7 @@ spring:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: dev
|
||||
active: uat
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
@ -143,7 +143,8 @@
|
||||
AND ProjectID = #{communityId}
|
||||
</if>
|
||||
<if test="nameOrAddress != null">
|
||||
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%', #{nameOrAddress}, '%'))
|
||||
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%',
|
||||
#{nameOrAddress}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@ -157,7 +158,8 @@
|
||||
AND ProjectID = #{communityId}
|
||||
</if>
|
||||
<if test="nameOrAddress != null">
|
||||
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%', #{nameOrAddress}, '%'))
|
||||
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%',
|
||||
#{nameOrAddress}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
|
||||
@ -170,17 +172,28 @@
|
||||
</select>
|
||||
<!-- 获取表名 -->
|
||||
<select id="yearMonthList" resultType="com.ruoyi.project.common.VueSelectModel">
|
||||
SELECT right(name,6) as value, right(name,6) as label
|
||||
SELECT top 12 right(name,6) as value, right(name,6) as label
|
||||
FROM sys.tables
|
||||
where name like 'DWA_PROJECTBASEPRICE_IMDT_%'
|
||||
order by cast(right(name,6) as int) desc
|
||||
</select>
|
||||
|
||||
<!-- <update id="updateComputeResidenceRentBasePrice" parameterType="com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice">-->
|
||||
<!-- update TLK_计价办公核准基价 set ITEM_YEARMONTH=ITEM_YEARMONTH-->
|
||||
<!-- <trim prefix="SET" suffixOverrides=",">-->
|
||||
<!-- </trim>-->
|
||||
<!-- where id = #{id}-->
|
||||
<!-- </update>-->
|
||||
<!-- 区域涨跌幅 -->
|
||||
<select id="getBlockChange" resultType="com.ruoyi.project.data.price.domain.DistrictBlockChange">
|
||||
select Block as name
|
||||
, avg(VOPPA) as value
|
||||
from dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth}
|
||||
where Block is not null
|
||||
group by Block
|
||||
order by avg(VOPPA)
|
||||
</select>
|
||||
<!--区域涨跌幅-->
|
||||
<select id="getCountyChange" resultType="com.ruoyi.project.data.price.domain.DistrictBlockChange">
|
||||
select left(County,2) as name
|
||||
, avg(VOPPA) as value
|
||||
from dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth}
|
||||
where County is not null
|
||||
group by left(County,2)
|
||||
order by avg(VOPPA)
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -11,7 +11,7 @@
|
||||
<result property="caseUnitPrice" column="均价售"/>
|
||||
<result property="name" column="楼盘名称"/>
|
||||
<result property="caseFloor" column="楼层"/>
|
||||
<result property="area" column="面积" javaType="java.math.BigDecimal"/>
|
||||
<result property="area" column="面积" javaType="java.math.BigDecimal" />
|
||||
<result property="managementFee" column="物业费"/>
|
||||
<result property="seatCount" column="工位数"/>
|
||||
<result property="address" column="地址"/>
|
||||
@ -32,17 +32,19 @@
|
||||
<result property="rentOfMonthly" column="月租金租"/>
|
||||
<result property="rentOfStandard" column="标准租金租"/>
|
||||
<result property="score" column="得房率"/>
|
||||
<result property="totalPrice" column="总价"/>
|
||||
<result property="unitPrice" column="单价"/>
|
||||
<result property="totalPrice" column="总价" javaType="java.math.BigDecimal"/>
|
||||
<result property="unitPrice" column="单价" javaType="java.math.BigDecimal"/>
|
||||
<result property="updateDate" column="更新时间" javaType="java.sql.Date"/>
|
||||
</resultMap>
|
||||
<select id="download" resultMap="DownloadMapping">
|
||||
select url, title, 容积率, 总价售, 均价售, 楼盘名称, 楼层, 面积, 物业费, 工位数, 地址, 地铁,
|
||||
select url, title, 容积率, 总价售, 均价售, 楼盘名称, 楼层, case 面积 when 'nan' then NULL ELSE 面积 END 面积,
|
||||
物业费, 工位数, 地址, 地铁,
|
||||
发布时间,房源编号, 百度lng, 百度lat, 区域, 分类, 来源, 等级, 楼盘网址, 装修,
|
||||
类型, 板块, 挂牌中介, 月租金租, 标准租金租, 更新时间, 得房率,
|
||||
case when 分类 = '售' then 总价售
|
||||
when 分类 = '租' then 月租金租 end as 总价,
|
||||
case when 分类 = '售' then 均价售
|
||||
when 分类 = '租' then 标准租金租 end as 单价
|
||||
case when 分类 = '售' then (case 总价售 when 'nan' then NULL ELSE 总价售 END)
|
||||
when 分类 = '租' then (case 月租金租 when 'nan' then NULL ELSE 月租金租 END) end as 总价,
|
||||
case when 分类 = '售' then (case 均价售 when 'nan' then NULL ELSE 均价售 END)
|
||||
when 分类 = '租' then (case 标准租金租 when 'nan' then NULL ELSE 标准租金租 END) end as 单价
|
||||
from dbo.办公
|
||||
where 更新时间 >= #{startDate} and 更新时间 <![CDATA[ < ]]> #{endDate}
|
||||
</select>
|
||||
|
@ -24,11 +24,12 @@
|
||||
<result property="casePrice" column="price" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseUrl" column="url"/>
|
||||
<result property="caseCommunityUrl" column="curl"/>
|
||||
<result property="caseCommunityName" column="cname"/>
|
||||
<result property="caseGetDate" column="created" javaType="java.sql.Date"/>
|
||||
<result property="caseProvider" column="caseProvider"/>
|
||||
</resultMap>
|
||||
<select id="download" resultMap="resultMapping">
|
||||
SELECT llid
|
||||
SELECT top 1000 llid
|
||||
,lcid
|
||||
,airaid
|
||||
,name
|
||||
@ -42,10 +43,8 @@
|
||||
,first_visit_time
|
||||
,visited_num_15
|
||||
,visited_num_30
|
||||
,postDate
|
||||
,decoration
|
||||
,address
|
||||
,created
|
||||
,statustxt
|
||||
,price
|
||||
,url
|
||||
|
@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceRentPlatformCaseMapper">
|
||||
<resultMap id="resultMapping" type="com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase">
|
||||
<resultMap id="resultMapping" type="com.ruoyi.project.data.cases.domain.OriginalResidencePlatformRentOpeningCase">
|
||||
<result property="caseArea" column="面积" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseBlock" column="block" />
|
||||
<result property="caseAddress" column="地址"/>
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
</resultMap>
|
||||
<select id="download" resultMap="resultMapping">
|
||||
select 面积
|
||||
select top 100 面积
|
||||
,block
|
||||
,地址
|
||||
,小区名
|
||||
@ -32,7 +32,6 @@
|
||||
,楼层
|
||||
,厅数
|
||||
,编号
|
||||
,type
|
||||
,price
|
||||
,区域
|
||||
,出租方式
|
||||
@ -40,6 +39,6 @@
|
||||
,来源
|
||||
,savetime
|
||||
FROM dbo.挂牌房源
|
||||
where savetime <![CDATA[ > ]]> #{startDate} and savetime <![CDATA[ <= ]]> #{endDate}
|
||||
where savetime <![CDATA[ > ]]> #{startDate,jdbcType=DATE} and savetime <![CDATA[ <= ]]> #{endDate,jdbcType=DATE}
|
||||
</select>
|
||||
</mapper>
|
@ -6,43 +6,43 @@
|
||||
<update id="createTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_OFFICECASELISTED_' + yearMonth + '_RAW'"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
drop table ${targetTableName};
|
||||
|
||||
create TABLE ${targetTableName}
|
||||
(
|
||||
ID uniqueidentifier not null primary key,
|
||||
url varchar (1000) NULL,
|
||||
title varchar (1000) NULL,
|
||||
容积率 varchar (1000) NULL,
|
||||
总价售 varchar (1000) NULL,
|
||||
均价售 varchar (1000) NULL,
|
||||
楼盘名称 varchar (1000) NULL,
|
||||
楼盘名称_M nvarchar (512) NULL,
|
||||
楼层 varchar (1000) NULL,
|
||||
面积 varchar (1000) NULL,
|
||||
物业费 varchar (1000) NULL,
|
||||
工位数 varchar (1000) NULL,
|
||||
地址 varchar (1000) NULL,
|
||||
地铁 varchar (1000) NULL,
|
||||
发布时间 date NULL,
|
||||
房源编号 varchar (1000) NULL,
|
||||
百度lng varchar (1000) NULL,
|
||||
百度lat varchar (1000) NULL,
|
||||
区域 varchar (1000) NULL,
|
||||
分类 varchar (1000) NULL,
|
||||
来源 varchar (1000) NULL,
|
||||
等级 varchar (1000) NULL,
|
||||
楼盘网址 varchar (1000) NULL,
|
||||
装修 varchar (1000) NULL,
|
||||
类型 varchar (1000) NULL,
|
||||
板块 varchar (1000) NULL,
|
||||
挂牌中介 varchar (1000) NULL,
|
||||
月租金租 varchar (1000) NULL,
|
||||
标准租金租 varchar (1000) NULL,
|
||||
更新时间 varchar (1000) NULL,
|
||||
得房率 varchar (1000) NULL,
|
||||
总价 decimal (18, 2) NULL,
|
||||
单价 decimal (18, 2) NULL
|
||||
case_id varchar(32) not null primary key,
|
||||
url varchar (1000) NULL,
|
||||
title varchar (1000) NULL,
|
||||
容积率 varchar (1000) NULL,
|
||||
总价售 varchar (1000) NULL,
|
||||
均价售 varchar (1000) NULL,
|
||||
楼盘名称 varchar (1000) NULL,
|
||||
楼盘名称_M nvarchar (512) NULL,
|
||||
楼层 varchar (1000) NULL,
|
||||
面积 varchar (1000) NULL,
|
||||
物业费 varchar (1000) NULL,
|
||||
工位数 varchar (1000) NULL,
|
||||
地址 varchar (1000) NULL,
|
||||
地铁 varchar (1000) NULL,
|
||||
发布时间 date NULL,
|
||||
房源编号 varchar (1000) NULL,
|
||||
百度lng varchar (1000) NULL,
|
||||
百度lat varchar (1000) NULL,
|
||||
区域 varchar (1000) NULL,
|
||||
分类 varchar (1000) NULL,
|
||||
来源 varchar (1000) NULL,
|
||||
等级 varchar (1000) NULL,
|
||||
楼盘网址 varchar (1000) NULL,
|
||||
装修 varchar (1000) NULL,
|
||||
类型 varchar (1000) NULL,
|
||||
板块 varchar (1000) NULL,
|
||||
挂牌中介 varchar (1000) NULL,
|
||||
月租金租 varchar (1000) NULL,
|
||||
标准租金租 varchar (1000) NULL,
|
||||
更新时间 date NULL,
|
||||
得房率 varchar (1000) NULL,
|
||||
总价 decimal (18, 2) NULL,
|
||||
单价 decimal (18, 2) NULL
|
||||
);
|
||||
</update>
|
||||
<!-- 创建人工修正表 -->
|
||||
@ -51,26 +51,107 @@
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
create table ${targetTableName}
|
||||
(
|
||||
BuildingID bigint NOT NULL,
|
||||
ProjectID bigint NULL,
|
||||
County nvarchar (512) NULL,
|
||||
Loop nvarchar (512) NULL,
|
||||
Block nvarchar (512) NULL,
|
||||
ProjectAddr nvarchar (1024) NULL,
|
||||
ProjectName nvarchar (1024) NULL,
|
||||
Year int NULL,
|
||||
AvgArea decimal (18, 2) NULL,
|
||||
TotalFloorSum nvarchar (32) NULL,
|
||||
UpperFloorSum nvarchar (32) NULL,
|
||||
OfficeClass nvarchar (256) NULL,
|
||||
Grade nvarchar (64) NULL,
|
||||
MainPrice_1 decimal (18, 2) NULL,
|
||||
MainPriceRent_1 decimal (18, 2) NULL,
|
||||
MainPrice decimal (18, 2) NULL,
|
||||
MainPriceRent decimal (18, 2) NULL,
|
||||
ModifyDate date NULL
|
||||
id int not null,
|
||||
BuildingID_P nvarchar(20) not null,
|
||||
ProjectID_P nvarchar(20) null,
|
||||
ProjectName nvarchar(200) null,
|
||||
ProjectAddr nvarchar(200) null,
|
||||
BuildingAddr nvarchar(200) null,
|
||||
County nvarchar(200) null,
|
||||
Loop nvarchar(200) null,
|
||||
Block nvarchar(200) null,
|
||||
Street nvarchar(200) null,
|
||||
Year int null,
|
||||
AvgArea decimal(10, 2) null,
|
||||
TotalFloorSum nvarchar(50) null,
|
||||
UpperFloorSum nvarchar(50) null,
|
||||
OfficeClass nvarchar(50) null,
|
||||
Grade nvarchar(50) null,
|
||||
MainPrice_1 decimal(18, 6) null,
|
||||
MainPriceRent_1 decimal(18, 6) null,
|
||||
MainPrice decimal(38, 6) null,
|
||||
MainPriceRent decimal(38, 6) null,
|
||||
MainPricePst decimal(38, 6) null,
|
||||
MainPriceRentPst decimal(38, 6) null,
|
||||
MainPriceType varchar(2) null,
|
||||
MainPriceRentType varchar(2) null,
|
||||
AreaCoff decimal(18, 6) null,
|
||||
YearCoff decimal(18, 6) null,
|
||||
BuildingCoff decimal(18, 6) null,
|
||||
BuildingStd bit null,
|
||||
AdjEvd nvarchar(1000) null,
|
||||
ModifyDate date not null
|
||||
);
|
||||
</update>
|
||||
<!--案例汇总表-->
|
||||
<update id="createAssembleTable">
|
||||
<bind name="targetTableName" value="'dbo.DW_OFFICECASE_COMM_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
(
|
||||
ID uniqueidentifier NOT NULL,
|
||||
url varchar (1000) NULL,
|
||||
title varchar (1000) NULL,
|
||||
容积率 varchar (1000) NULL,
|
||||
总价售 varchar (1000) NULL,
|
||||
均价售 varchar (1000) NULL,
|
||||
楼盘名称 varchar (1000) NULL,
|
||||
楼盘名称_M nvarchar (512) NULL,
|
||||
楼层 varchar (1000) NULL,
|
||||
面积 varchar (1000) NULL,
|
||||
物业费 varchar (1000) NULL,
|
||||
工位数 varchar (1000) NULL,
|
||||
地址 varchar (1000) NULL,
|
||||
地铁 varchar (1000) NULL,
|
||||
发布时间 date NULL,
|
||||
房源编号 varchar (1000) NULL,
|
||||
百度lng varchar (1000) NULL,
|
||||
百度lat varchar (1000) NULL,
|
||||
区域 varchar (1000) NULL,
|
||||
分类 varchar (1000) NULL,
|
||||
来源 varchar (1000) NULL,
|
||||
等级 varchar (1000) NULL,
|
||||
楼盘网址 varchar (1000) NULL,
|
||||
装修 varchar (1000) NULL,
|
||||
类型 varchar (1000) NULL,
|
||||
板块 varchar (1000) NULL,
|
||||
挂牌中介 varchar (1000) NULL,
|
||||
月租金租 varchar (1000) NULL,
|
||||
标准租金租 varchar (1000) NULL,
|
||||
更新时间 varchar (1000) NULL,
|
||||
得房率 varchar (1000) NULL,
|
||||
总价 decimal (18, 2) NULL,
|
||||
单价 decimal (18, 2) NULL,
|
||||
BuildingID_P bigint NULL,
|
||||
ProjectID_P bigint NULL,
|
||||
TotalFloorSum nvarchar (32) NULL,
|
||||
FloorCoff decimal (7, 4) NULL,
|
||||
DecorationCoff decimal (7, 4) NULL,
|
||||
PriceAmend numeric (38, 12) NULL,
|
||||
MainPrice_1 decimal (38, 6) NULL,
|
||||
MainPriceRent_1 decimal (38, 6) NULL,
|
||||
ListedPrice_1 decimal (38, 6) NULL,
|
||||
ListedPriceRent_1 decimal (38, 6) NULL,
|
||||
ListedPrice decimal (38, 6) NULL,
|
||||
ListedPriceRent decimal (38, 6) NULL,
|
||||
VOPP numeric (38, 6) NULL,
|
||||
VOPPT nvarchar (32) NULL
|
||||
)
|
||||
</update>
|
||||
<!-- 初始化汇总表-->
|
||||
<update id="initAssembleTable">
|
||||
<bind name="targetTableName" value="'dbo.DW_OFFICECASE_COMM_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
</update>
|
||||
<!-- 初始化汇总表-->
|
||||
<update id="initPriceTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_OFFICE_BUILDING_PRICE_INFO_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
</update>
|
||||
</mapper>
|
@ -5,122 +5,191 @@
|
||||
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceRentOpeningCaseMapper">
|
||||
|
||||
<update id="createTable">
|
||||
<bind name="targetTableName" value="'dbo.original_residence_rent_opening_case_' + yearMonth"/>
|
||||
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_RENT_LJ_' + yearMonth +'_RAW' "/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
drop table ${targetTableName};
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
create table ${targetTableName}
|
||||
(
|
||||
case_id varchar (32) NOT NULL,
|
||||
case_no nvarchar (32) NULL,
|
||||
case_lianjia_id nvarchar (50) NOT null primary key,
|
||||
case_lianjia_community_id nvarchar (50) NOT NULL,
|
||||
case_title nvarchar (500) NOT NULL,
|
||||
clean_property_type nvarchar (20) NULL,
|
||||
case_apartment_layout nvarchar (500) NOT NULL,
|
||||
case_house_structure nvarchar (50) NULL,
|
||||
case_area decimal (10, 2) NOT NULL,
|
||||
case_total_area decimal (10, 2) NOT NULL,
|
||||
case_rent_type nvarchar (20) NULL,
|
||||
case_status nvarchar (20) NULL,
|
||||
case_block nvarchar (20) NULL,
|
||||
case_county nvarchar (20) NULL,
|
||||
case_loop nvarchar (20) NULL,
|
||||
case_hall_num int NULL,
|
||||
case_room_num int NULL,
|
||||
case_underground_area decimal (10, 2) NULL,
|
||||
case_toward nvarchar (50) NOT NULL,
|
||||
clean_toward nvarchar (50) NULL,
|
||||
case_storey nvarchar (20) NOT NULL,
|
||||
clean_total_floor int NOT NULL,
|
||||
clean_current_floor_desc nvarchar (20) NULL,
|
||||
case_elevator nvarchar (20) NULL,
|
||||
clean_elevator nvarchar (20) NULL,
|
||||
case_tihu nvarchar (20) NULL,
|
||||
case_decoration nvarchar (20) NULL,
|
||||
clean_decoration nvarchar (50) NULL,
|
||||
case_year int NOT NULL,
|
||||
clean_year int NOT NULL,
|
||||
case_address nvarchar (500) NULL,
|
||||
case_vid nvarchar (500) NULL,
|
||||
case_chan_quan_xing_zhi nvarchar (200) NULL,
|
||||
case_price decimal (18, 2) NOT NULL,
|
||||
clean_unit_price decimal (18, 2) NOT NULL,
|
||||
clean_total_price decimal (18, 2) NOT NULL,
|
||||
case_community_name nvarchar (500) NULL,
|
||||
case_visited_num int NOT NULL,
|
||||
case_visited_num_15 int NOT NULL,
|
||||
case_visited_num_30 int NOT NULL,
|
||||
case_latest_deal_date date NULL,
|
||||
case_latest_visited_date date NULL,
|
||||
case_first_visited_date date NULL,
|
||||
case_url nvarchar (500) NOT NULL,
|
||||
case_community_url nvarchar (500) NOT NULL,
|
||||
case_get_date date NOT NULL,
|
||||
case_provider nvarchar (50) NOT NULL,
|
||||
uv_community_name nvarchar (500) NULL,
|
||||
uv_community_address nvarchar (1024) NULL,
|
||||
uv_community_id nvarchar (20) NULL,
|
||||
uv_building_id nvarchar (20) NULL,
|
||||
uv_county nvarchar (50) NULL,
|
||||
uv_block nvarchar (50) NULL,
|
||||
uv_loop nvarchar (50) NULL,
|
||||
area_coefficient decimal (18, 6) NULL,
|
||||
toward_coefficient decimal (18, 6) NULL,
|
||||
floor_coefficient decimal (18, 6) NULL,
|
||||
decoration_coefficient int NULL,
|
||||
year_coefficient decimal (18, 6) NULL,
|
||||
building_coefficient decimal (18, 6) NULL,
|
||||
adjust_unit_price decimal (18, 2) NULL,
|
||||
clean_project_level nvarchar (50) NULL,
|
||||
create_time datetime NOT NULL
|
||||
case_id varchar(32) not null
|
||||
, Llid nvarchar(64)
|
||||
, Lcid nvarchar(64)
|
||||
, Airaid nvarchar(64)
|
||||
, Name sql_variant
|
||||
, Type nvarchar(128)
|
||||
, Roomtype nvarchar(50)
|
||||
, Area decimal(18, 2)
|
||||
, TotalArea decimal(18, 2)
|
||||
, Towards nvarchar(50)
|
||||
, Storey nvarchar(50)
|
||||
, Visited_Num int
|
||||
, First_Visit_Time date
|
||||
, Visited_Num_15 int
|
||||
, Visited_Num_30 int
|
||||
, PostDate date
|
||||
, Decoration nvarchar(50)
|
||||
, Address nvarchar(1024)
|
||||
, DataType nvarchar(128)
|
||||
, Created datetime
|
||||
, Modified datetime
|
||||
, StatusTxt nvarchar(1024)
|
||||
, Price decimal(18, 2)
|
||||
, Url nvarchar(512)
|
||||
, Curl nvarchar(512)
|
||||
, Cname nvarchar(1024)
|
||||
, SynDate date
|
||||
);
|
||||
</update>
|
||||
|
||||
<update id="createCleanTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth"/>
|
||||
-- CREATE TABLE ${targetTableName}
|
||||
-- (
|
||||
-- case_id varchar (32) NOT NULL,
|
||||
-- case_no nvarchar (32) NULL,
|
||||
-- case_lianjia_id nvarchar (50) NOT null primary key,
|
||||
-- case_lianjia_community_id nvarchar (50) NOT NULL,
|
||||
-- case_title nvarchar (500) NOT NULL,
|
||||
-- clean_property_type nvarchar (20) NULL,
|
||||
-- case_apartment_layout nvarchar (500) NOT NULL,
|
||||
-- case_house_structure nvarchar (50) NULL,
|
||||
-- case_area decimal (10, 2) NOT NULL,
|
||||
-- case_total_area decimal (10, 2) NOT NULL,
|
||||
-- case_rent_type nvarchar (20) NULL,
|
||||
-- case_status nvarchar (20) NULL,
|
||||
-- case_block nvarchar (20) NULL,
|
||||
-- case_county nvarchar (20) NULL,
|
||||
-- case_loop nvarchar (20) NULL,
|
||||
-- case_hall_num int NULL,
|
||||
-- case_room_num int NULL,
|
||||
-- case_underground_area decimal (10, 2) NULL,
|
||||
-- case_toward nvarchar (50) NOT NULL,
|
||||
-- clean_toward nvarchar (50) NULL,
|
||||
-- case_storey nvarchar (20) NOT NULL,
|
||||
-- clean_total_floor int NOT NULL,
|
||||
-- clean_current_floor_desc nvarchar (20) NULL,
|
||||
-- case_elevator nvarchar (20) NULL,
|
||||
-- clean_elevator nvarchar (20) NULL,
|
||||
-- case_tihu nvarchar (20) NULL,
|
||||
-- case_decoration nvarchar (20) NULL,
|
||||
-- clean_decoration nvarchar (50) NULL,
|
||||
-- case_year int NOT NULL,
|
||||
-- clean_year int NOT NULL,
|
||||
-- case_address nvarchar (500) NULL,
|
||||
-- case_vid nvarchar (500) NULL,
|
||||
-- case_chan_quan_xing_zhi nvarchar (200) NULL,
|
||||
-- case_price decimal (18, 2) NOT NULL,
|
||||
-- clean_unit_price decimal (18, 2) NOT NULL,
|
||||
-- clean_total_price decimal (18, 2) NOT NULL,
|
||||
-- case_community_name nvarchar (500) NULL,
|
||||
-- case_visited_num int NOT NULL,
|
||||
-- case_visited_num_15 int NOT NULL,
|
||||
-- case_visited_num_30 int NOT NULL,
|
||||
-- case_latest_deal_date date NULL,
|
||||
-- case_latest_visited_date date NULL,
|
||||
-- case_first_visited_date date NULL,
|
||||
-- case_url nvarchar (500) NOT NULL,
|
||||
-- case_community_url nvarchar (500) NOT NULL,
|
||||
-- case_get_date date NOT NULL,
|
||||
-- case_provider nvarchar (50) NOT NULL,
|
||||
-- uv_community_name nvarchar (500) NULL,
|
||||
-- uv_community_address nvarchar (1024) NULL,
|
||||
-- uv_community_id nvarchar (20) NULL,
|
||||
-- uv_building_id nvarchar (20) NULL,
|
||||
-- uv_county nvarchar (50) NULL,
|
||||
-- uv_block nvarchar (50) NULL,
|
||||
-- uv_loop nvarchar (50) NULL,
|
||||
-- area_coefficient decimal (18, 6) NULL,
|
||||
-- toward_coefficient decimal (18, 6) NULL,
|
||||
-- floor_coefficient decimal (18, 6) NULL,
|
||||
-- decoration_coefficient int NULL,
|
||||
-- year_coefficient decimal (18, 6) NULL,
|
||||
-- building_coefficient decimal (18, 6) NULL,
|
||||
-- adjust_unit_price decimal (18, 2) NULL,
|
||||
-- clean_project_level nvarchar (50) NULL,
|
||||
-- create_time datetime NOT NULL
|
||||
-- );
|
||||
</update>
|
||||
<!-- 租赁平台案例 -->
|
||||
<update id="createPlatformCaseTable">
|
||||
<bind name="targetTableName" value="'dbo.residence_rent_platform_case_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
drop table ${targetTableName};
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
(
|
||||
case_id varchar(32) not null,
|
||||
HouseholdsID_LJ bigint not null primary key,
|
||||
ProjectID_LJ bigint null,
|
||||
ProjectID bigint null,
|
||||
Roomtype nvarchar(64) null,
|
||||
Area decimal(18, 2) null,
|
||||
Towards nvarchar(64) null,
|
||||
UpperFloorSum nvarchar(32) null,
|
||||
UpperFloorNum nvarchar(32) null,
|
||||
Elevator tinyint null,
|
||||
Decoration nvarchar(64) null,
|
||||
Year int null,
|
||||
AreaCoff decimal(7, 4) null,
|
||||
TowardsCoff decimal(7, 4) null,
|
||||
FloorCoff decimal(7, 4) null,
|
||||
DecorationRng int null,
|
||||
YearCoff decimal(7, 4) null,
|
||||
BuildingCoff decimal(7, 4) null,
|
||||
PriceTotal decimal(18, 2) null,
|
||||
PriceUnit decimal(18, 2) not null,
|
||||
PriceUnitAdj decimal(18, 2) not null,
|
||||
Visited_Num int null,
|
||||
First_Visit_Time date null,
|
||||
Visited_Num_15 int null,
|
||||
Visited_Num_30 int null,
|
||||
Status tinyint null,
|
||||
AdjustedValue decimal(18, 2) null,
|
||||
AdjustedPst decimal(18, 6) null,
|
||||
AdjustedCumValue decimal(18, 2) null,
|
||||
AdjustedCumPst decimal(18, 6) null,
|
||||
AdjustedCumValueAbs decimal(18, 2) null,
|
||||
AdjustedCumPstAbs decimal(18, 6) null,
|
||||
AdjustedCumNum int null,
|
||||
PriceTotalIn decimal(18, 2) null,
|
||||
PriceTotalOut decimal(18, 2) null,
|
||||
PriceDateIn date null,
|
||||
PriceDateOut date null
|
||||
case_id varchar(32) not null,
|
||||
case_area varchar (255) NULL,
|
||||
case_block varchar (255) NULL,
|
||||
case_address varchar (255) NULL,
|
||||
case_community_name varchar (255) NULL,
|
||||
case_url varchar (255) NULL,
|
||||
case_decoration varchar (255) NULL,
|
||||
case_floor varchar (255) NULL,
|
||||
case_hall_num varchar (255) NULL,
|
||||
case_no varchar (255) NULL,
|
||||
case_type varchar (255) NULL,
|
||||
case_price varchar (255) NULL,
|
||||
case_county varchar (255) NULL,
|
||||
case_rent_type varchar (255) NULL,
|
||||
case_room_num varchar (255) NULL,
|
||||
case_source varchar (255) NULL,
|
||||
savetime date NULL
|
||||
)
|
||||
</update>
|
||||
<update id="createCleanTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_RENT_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
|
||||
create table ${targetTableName}
|
||||
(
|
||||
SID int identity
|
||||
, HouseholdsID_SRC nvarchar(64) primary key
|
||||
, ProjectID_SRC nvarchar(64) not null
|
||||
, ProjectID bigint
|
||||
, BuildingID bigint
|
||||
, RentType tinyint
|
||||
, Room tinyint
|
||||
, Hall tinyint
|
||||
, Bashroom tinyint
|
||||
, Area decimal(18, 2)
|
||||
, Towards nvarchar(64)
|
||||
, UpperFloorSum nvarchar(32)
|
||||
, UpperFloorNum nvarchar(32)
|
||||
, Elevator tinyint
|
||||
, Decoration nvarchar(64)
|
||||
, Year int
|
||||
, AreaCoff decimal(7, 4)
|
||||
, TowardsCoff decimal(7, 4)
|
||||
, FloorCoff decimal(7, 4)
|
||||
, DecorationRng int
|
||||
, YearCoff decimal(7, 4)
|
||||
, BuildingCoff decimal(7, 4)
|
||||
, RoomTypeCoff decimal(7, 4)
|
||||
, PriceTotal decimal(18, 2) not null
|
||||
, PriceUnit decimal(18, 2) not null
|
||||
, PriceScatterRent decimal(18, 2)
|
||||
, PriceEntireRent decimal(18, 2)
|
||||
, PriceShareRent0 decimal(18, 2)
|
||||
, PriceShareRent decimal(18, 2)
|
||||
, Visited_Num int
|
||||
, First_Visit_Time date
|
||||
, Visited_Num_15 int
|
||||
, Visited_Num_30 int
|
||||
, Status tinyint
|
||||
, AdjustedValue decimal(18, 2)
|
||||
, AdjustedPst decimal(18, 6)
|
||||
, AdjustedCumValue decimal(18, 2)
|
||||
, AdjustedCumPst decimal(18, 6)
|
||||
, AdjustedCumValueAbs decimal(18, 2)
|
||||
, AdjustedCumPstAbs decimal(18, 6)
|
||||
, AdjustedCumNum int
|
||||
, PriceTotalIn decimal(18, 2)
|
||||
, PriceTotalOut decimal(18, 2)
|
||||
, PriceDateIn date
|
||||
, PriceDateOut date
|
||||
, Origin nvarchar(64)
|
||||
, UrlHouseholds nvarchar(max)
|
||||
, UrlProjects nvarchar(max)
|
||||
, CaseName nvarchar(1024)
|
||||
);
|
||||
</update>
|
||||
<update id="createAssembleTable">
|
||||
@ -266,14 +335,14 @@
|
||||
</update>
|
||||
|
||||
<!-- 核准住宅租赁基价 -->
|
||||
<update id="createUltimateTable">
|
||||
<update id="createUltimatePriceTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_PROJECT_RENT_PRICE_INFO_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
|
||||
create table ODS_PROJECT_RENT_PRICE_INFO_202007
|
||||
create table ${targetTableName}
|
||||
(
|
||||
id uniqueidentifier primary key
|
||||
id varchar(32) primary key
|
||||
, ProjectID bigint not null
|
||||
, PriceType int
|
||||
, BasePrice_1 decimal(18, 2)
|
||||
|
@ -88,6 +88,16 @@
|
||||
<if test="status != null">
|
||||
AND a.STATUS = #{status}
|
||||
</if>
|
||||
<if test="isStandardBuilding != null">
|
||||
AND a.BuildingStd = #{isStandardBuilding}
|
||||
</if>
|
||||
<if test="nameOrAddress != null">
|
||||
AND (
|
||||
a.ProjectName like concat('%', #{nameOrAddress} ,'%') or
|
||||
a.ProjectAddr like concat('%', #{nameOrAddress} ,'%') or
|
||||
a.BuildingAddr like concat('%', #{nameOrAddress} ,'%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -104,8 +114,17 @@
|
||||
<if test="status != null">
|
||||
AND a.STATUS = #{status}
|
||||
</if>
|
||||
<if test="isStandardBuilding != null">
|
||||
AND a.BuildingStd = #{isStandardBuilding}
|
||||
</if>
|
||||
<if test="nameOrAddress != null">
|
||||
AND (
|
||||
a.ProjectName like concat('%', #{nameOrAddress} ,'%') or
|
||||
a.ProjectAddr like concat('%', #{nameOrAddress} ,'%') or
|
||||
a.BuildingAddr like concat('%', #{nameOrAddress} ,'%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
order by a.id desc OFFSET #{pageIndex} rows fetch next #{pageSize} rows only;
|
||||
</select>
|
||||
|
||||
@ -293,4 +312,18 @@
|
||||
from ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth}
|
||||
where id=#{id};
|
||||
</update>
|
||||
<update id="initImport">
|
||||
IF OBJECT_ID('BatchImportOfArtificialOfficePrice', 'P') IS NOT NULL
|
||||
drop procedure BatchImportOfArtificialOfficePrice;
|
||||
</update>
|
||||
<!--准备批量导入-->
|
||||
<update id="prepareBachImport">
|
||||
create procedure dbo.BatchImportOfArtificialOfficePrice @table DWA_PROJECTBASEPRICE_OFFICE_MANU_Table readonly
|
||||
as
|
||||
begin
|
||||
insert into dbo.DWA_PROJECTBASEPRICE_OFFICE_MANU_${yearMonth} (id,BuildingID_P,ProjectID_P,ProjectName,ProjectAddr,BuildingAddr,County,Loop,Block,Street,Year,AvgArea,TotalFloorSum,UpperFloorSum,OfficeClass,Grade,MainPrice_1,MainPriceRent_1,MainPrice,MainPriceRent,MainPricePst,MainPriceRentPst,MainPriceType,MainPriceRentType,AreaCoff,YearCoff,BuildingCoff,BuildingStd,AdjEvd,ModifyDate)
|
||||
select id,BuildingID_P,ProjectID_P,ProjectName,ProjectAddr,BuildingAddr,County,Loop,Block,Street,Year,AvgArea,TotalFloorSum,UpperFloorSum,OfficeClass,Grade,MainPrice_1,MainPriceRent_1,MainPrice,MainPriceRent,MainPricePst,MainPriceRentPst,MainPriceType,MainPriceRentType,AreaCoff,YearCoff,BuildingCoff,BuildingStd,AdjEvd,getdate()
|
||||
from @table;
|
||||
end;
|
||||
</update>
|
||||
</mapper>
|
@ -74,7 +74,7 @@
|
||||
<select id="yearMonthList" resultType="com.ruoyi.project.common.VueSelectModel">
|
||||
SELECT right(name,6) as value, right(name,6) as label
|
||||
FROM sys.tables
|
||||
where name like 'ODS_PROJECT_PRICE_INFO_%'
|
||||
where name like 'ODS_PROJECT_PRICE_INFO_%' and name not like '%_bak'
|
||||
order by cast(right(name,6) as int) desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,384 @@
|
||||
create table #HousingCaseListAdj
|
||||
(
|
||||
HouseholdsID_SRC nvarchar(64) primary key
|
||||
, ProjectID_SRC nvarchar(64) not null
|
||||
, RentType tinyint
|
||||
, Room tinyint
|
||||
, Hall tinyint
|
||||
, Bashroom tinyint
|
||||
, Area decimal(18, 2)
|
||||
, Towards nvarchar(64)
|
||||
, UpperFloorSum nvarchar(32)
|
||||
, UpperFloorNum nvarchar(32)
|
||||
, Elevator tinyint
|
||||
, Decoration nvarchar(64)
|
||||
, Year int
|
||||
, PriceTotal decimal(18, 2) not null
|
||||
, PriceUnit decimal(18, 2) not null
|
||||
, Visited_Num int
|
||||
, First_Visit_Time date
|
||||
, Visited_Num_15 int
|
||||
, Visited_Num_30 int
|
||||
, PriceDateIn date
|
||||
, TowardsCoff decimal(7, 4)
|
||||
, Origin nvarchar(64)
|
||||
, UrlHouseholds nvarchar(max)
|
||||
, UrlProjects nvarchar(max)
|
||||
, CaseName nvarchar(1024)
|
||||
);
|
||||
|
||||
|
||||
DECLARE @llid NVARCHAR(64), @lcid NVARCHAR(64), @name NVARCHAR(1024), @roomtype nvarchar(50), @area decimal(18,2)
|
||||
DECLARE @towards nvarchar(50), @storey nvarchar(50), @Created DATE, @price decimal(18,2), @UrlHouseholds NVARCHAR(MAX), @UrlProjects NVARCHAR(MAX)
|
||||
DECLARE @RentType TINYINT, @Room TINYINT, @Hall TINYINT, @Bashroom TINYINT, @TowardsCoff DECIMAL(7,4),@UpperFloorSum NVARCHAR(32), @UpperFloorNum NVARCHAR(32), @priceunit decimal(18,2)
|
||||
--朝向修正系数(由于单个案例可能有多个朝向, 所以多个朝向的修正系数需要通过游标完成)
|
||||
select SingleKey, Coefficient INTO #TEMP from DIM_PARAMETERS where ProjectType = '公寓' and CoffType='朝向(租金)'
|
||||
DECLARE Record2Insert CURSOR FOR
|
||||
SELECT llid, lcid, cast([Name] as nvarchar(1024)) as Name, roomtype, area, towards, storey, Created, price, Url, Curl FROM ODS_HOUSINGCASELISTED_RENT_LJ_#yearMonth#_Raw
|
||||
OPEN Record2Insert
|
||||
FETCH NEXT FROM Record2Insert INTO @llid , @lcid , @name, @roomtype , @area , @towards , @storey , @Created, @price, @UrlHouseholds, @UrlProjects
|
||||
SET NOCOUNT ON --忽略行数显示
|
||||
WHILE @@FETCH_STATUS=0
|
||||
BEGIN
|
||||
BEGIN
|
||||
--租赁类型
|
||||
SET @RentType = CASE WHEN LEFT(@name,2) IN ('整租') THEN 1
|
||||
WHEN LEFT(@name,2) IN ('散租') THEN 2
|
||||
WHEN LEFT(@name,2) IN ('分租') THEN 3
|
||||
ELSE NULL END
|
||||
--室厅卫
|
||||
SET @Room = CASE WHEN isnumeric(substring(@roomtype, 1, charindex('室', @roomtype, 1)-1))=1 THEN substring(@roomtype, 1, charindex('室', @roomtype, 1)-1) END
|
||||
SET @Hall = CASE WHEN isnumeric(substring(@roomtype, charindex('室', @roomtype, 1)+1, charindex('厅', @roomtype, 1)-charindex('室', @roomtype, 1)-1))=1
|
||||
THEN substring(@roomtype, charindex('室', @roomtype, 1)+1, charindex('厅', @roomtype, 1)-charindex('室', @roomtype, 1)-1) END
|
||||
SET @Bashroom = CASE WHEN isnumeric(substring(@roomtype, charindex('厅', @roomtype, 1)+1, charindex('卫', @roomtype, 1)-charindex('厅', @roomtype, 1)-1))=1
|
||||
THEN substring(@roomtype, charindex('厅', @roomtype, 1)+1, charindex('卫', @roomtype, 1)-charindex('厅', @roomtype, 1)-1) END
|
||||
|
||||
--朝向及朝向修正系数 (#lastYearMonth#10修改:由于链家页面修改,朝向规则修改如下)
|
||||
if @towards in ('暂无数据', '--')
|
||||
set @towards = NULL
|
||||
-- else
|
||||
-- set @towards = substring(@towards, 2, len(@towards)-1) --去掉字段中的’朝‘字
|
||||
while patindex('% %',@towards)>0
|
||||
SET @towards=STUFF(@towards, patindex('% %',@towards),1,'|') --多个朝向用’|‘隔开
|
||||
select @TowardsCoff=case when Coefficient is null then 1 else Coefficient end
|
||||
from (select avg(Coefficient) Coefficient from StringSplit(@towards, '|') a inner join #TEMP b on a.StringSub = b.SingleKey)t --多个朝向的修正系数取均值
|
||||
|
||||
--楼层处理
|
||||
set @UpperFloorNum = case when substring(@storey,1,3)='高楼层' then '高区'
|
||||
when substring(@storey,1,3)='中楼层' then '中区'
|
||||
when substring(@storey,1,3)='低楼层' then '低区' end
|
||||
set @UpperFloorSum = substring(@storey,charindex('/',@storey,1)+1,charindex('层',@storey,charindex('/',@storey,1))-charindex('/',@storey,1)-1)
|
||||
|
||||
--单价
|
||||
set @priceunit = @price*1.0/isnull(@area,1)
|
||||
|
||||
--插入数据
|
||||
insert into #HousingCaseListAdj values(@llid, @lcid, @RentType, @Room, @Hall, @Bashroom, @area, @towards, @UpperFloorSum, @UpperFloorNum, NULL, NULL, NULL,
|
||||
@price, @priceunit, NULL, NULL, NULL,NULL, @Created, @TowardsCoff, '链家', @UrlHouseholds, @UrlProjects, @name)
|
||||
|
||||
END
|
||||
FETCH NEXT FROM Record2Insert INTO @llid , @lcid , @name, @roomtype , @area , @towards , @storey , @Created, @price, @UrlHouseholds, @UrlProjects
|
||||
END
|
||||
CLOSE Record2Insert
|
||||
DEALLOCATE Record2Insert
|
||||
SET NOCOUNT OFF
|
||||
|
||||
drop table #TEMP
|
||||
|
||||
/****个性化:
|
||||
-----1)由于链家目前已没有`散租`,都已标记为`整租`,而租金计算用到`散租`,因此这里把链家的整租都修改为散租
|
||||
-----2)装修为空的统一调整为`中装`
|
||||
****/
|
||||
update #HousingCaseListAdj
|
||||
set RentType=2 where RentType=1
|
||||
|
||||
update #HousingCaseListAdj
|
||||
set RentType=2 where RentType is null
|
||||
|
||||
update #HousingCaseListAdj
|
||||
set Decoration='中装' where Decoration is null
|
||||
|
||||
|
||||
|
||||
/****************插入租赁平台数据*********************/
|
||||
--来源页房源ID提取
|
||||
select distinct case_url,
|
||||
case when case_source in ('21世纪不动产') then 'century21_'+reverse(substring(reverse(case_url), charindex('.', reverse(case_url))+1, charindex('/', reverse(case_url))- charindex('.', reverse(case_url))-1))
|
||||
when case_source in ('蛋壳') then 'danken_'+reverse(substring(reverse(case_url), charindex('.', reverse(case_url))+1, charindex('/', reverse(case_url))- charindex('.', reverse(case_url))-1))
|
||||
when case_source in ('我爱我家') then '5i5j_'+reverse(substring(reverse(case_url), charindex('.', reverse(case_url))+1, charindex('/', reverse(case_url))- charindex('.', reverse(case_url))-1))
|
||||
when case_source in ('中原地产') then 'centanet_'+reverse(substring(reverse(case_url), charindex('.', reverse(case_url))+1, charindex('/', reverse(case_url))- charindex('.', reverse(case_url))-1))
|
||||
when case_source in ('自如') then 'ziroom_'+reverse(substring(reverse(case_url), charindex('.', reverse(case_url))+1, charindex('/', reverse(case_url))- charindex('.', reverse(case_url))-1))
|
||||
when case_source in ('平安好房') then 'pinganfang_'+reverse(substring(reverse(case_url), charindex('lmth.', reverse(case_url))+5, charindex('.di', reverse(case_url))- charindex('lmth.', reverse(case_url))-5))
|
||||
when case_source in ('青客') then 'qk365_'+reverse(substring(reverse(case_url), 1, charindex('/', reverse(case_url))- 1))
|
||||
when case_source in ('太平洋房屋') then 'taiwu_'+reverse(substring(reverse(case_url), 2, charindex('/', reverse(case_url), 2)- 2))
|
||||
when case_source in ('信义房屋') then 'sinyi'+reverse(substring(reverse(case_url), 1, charindex('=di', reverse(case_url), 2)- 1)) end as HouseholdsID
|
||||
into #HouseholdsID
|
||||
from residence_rent_platform_case_#yearMonth#
|
||||
|
||||
|
||||
select t.*
|
||||
into #HouseingCaseZFZL
|
||||
from (
|
||||
select row_number()over(partition by b.HouseholdsID order by newid()) sq, a.*, b.HouseholdsID
|
||||
from (select * from residence_rent_platform_case_#yearMonth# where case_source<>'链家') a
|
||||
inner join #HouseholdsID b
|
||||
on a.case_url = b.case_url
|
||||
)t where sq=1;
|
||||
|
||||
|
||||
INSERT INTO #HousingCaseListAdj
|
||||
SELECT HouseholdsID AS HouseholdsID_SRC, '-1' AS ProjectID_SRC,
|
||||
CASE WHEN case_rent_type='整租' then 1
|
||||
WHEN case_rent_type='散租' then 2
|
||||
WHEN case_rent_type='分租' then 3
|
||||
WHEN case_rent_type='按间' then 3 END AS RentType,
|
||||
case_room_num AS Room, case_hall_num AS Hall, NULL AS Bashroom, case_area AS Area, NULL AS Towards, NULL AS UpperFloorSum,
|
||||
CASE WHEN case_floor LIKE '%低%' THEN '低区'
|
||||
WHEN case_floor LIKE '%中%' THEN '中区'
|
||||
WHEN case_floor LIKE '%高%' THEN '高区' END AS UpperFloorNum, NULL AS Elevator, case_decoration AS Decoration, NULL AS Year, ISNULL(case_price, 1) PriceTotal,
|
||||
ISNULL(CONVERT(DECIMAL(18,2),case_price), 1)*1.0/ISNULL(CONVERT(DECIMAL(18,2),case_area),1) AS PriceUnit, NULL Visited_Num, NULL First_Visit_Time, NULL Visited_Num_15, NULL Visited_Num_30, savetime AS PriceDateIn,
|
||||
NULL AS TowardsCoff, case_source AS Origin, case_url as UrlHouseholds, NULL as UrlProjects, case_community_name + '|' + case_address as CaseName
|
||||
FROM #HouseingCaseZFZL A
|
||||
|
||||
/****************地址匹配*********************/
|
||||
--select top 3000* from BAK_HousingCaseListAdj_20190725 order by newid()
|
||||
create table #HousingCaseListAdj2ID
|
||||
(
|
||||
HouseholdsID_SRC nvarchar(64) primary key
|
||||
, ProjectID_SRC nvarchar(64) not null
|
||||
, ProjectID bigint
|
||||
, BuildingID bigint
|
||||
);
|
||||
|
||||
--链家案例地址匹配
|
||||
INSERT INTO #HousingCaseListAdj2ID
|
||||
SELECT A.HouseholdsID_SRC, A.ProjectID_SRC, B.ProjectID, B.BuildingID
|
||||
FROM #HousingCaseListAdj A
|
||||
LEFT JOIN DIM_PROJECTID_LJ2AI B
|
||||
ON A.ProjectID_SRC = cast(B.ProjectID_LJ as varchar)
|
||||
WHERE A.Origin = '链家'
|
||||
|
||||
--其他房源的地址匹配
|
||||
|
||||
select
|
||||
CommunityId as ProjectID,
|
||||
ITEM_RANAME as ProjectName,
|
||||
ITEM_RAADRESS as ProjectAddr,
|
||||
County,
|
||||
Block,
|
||||
Loop,
|
||||
item_UpperFloorSum as UpperFloorSum
|
||||
into #TEMP_ODS_PROJECT_INFO
|
||||
from obpm_LianCheng_Data.dbo.V_ResidenceCommunity;
|
||||
|
||||
with HouseingCaseZFZL_STD as(
|
||||
select a.case_county , HouseholdsID,
|
||||
case when [地址_1] is not null then [地址_1] else case_address end as [地址_1],
|
||||
case when [小区名_1] is not null then [小区名_1] else case_community_name end as [小区名_1]
|
||||
from (
|
||||
SELECT A.*,
|
||||
STUFF(case_address, patindex('%(%',case_address),patindex('%)%',case_address)-patindex('%(%',case_address)+1,'') as [地址_1],
|
||||
STUFF(case_community_name, patindex('%(%',case_community_name),patindex('%)%',case_community_name)-patindex('%(%',case_community_name)+1,'') as [小区名_1]
|
||||
FROM #HouseingCaseZFZL A
|
||||
)a
|
||||
)
|
||||
select t.HouseHoldsID as HouseHoldsID_SRC, '-1' as ProjectID_SRC,
|
||||
case when a.[小区ID] is not null then a.[小区ID]
|
||||
when c.[小区ID] is not null then c.[小区ID]
|
||||
else d.ProjectID end as "ProjectID",
|
||||
a.[楼栋ID] as "BuildingID"
|
||||
INTO #HousingCaseListAdj2ID_ZFZL
|
||||
from HouseingCaseZFZL_STD t
|
||||
left join (select * from [AI楼栋地址20190729] where [项目类型] = '居住') a
|
||||
on LEFT(a.[新区域],2)=LEFT(t.case_county,2) and (t.[地址_1] = a.[地址栋号] or t.[地址_1] = a.[区址])
|
||||
left join (select * from [AI小区地址20190729] where [项目类型] = '居住') c
|
||||
on LEFT(c.[新区域],2)=LEFT(t.case_county,2) and (t.[小区名_1] = c.[小区名址] or t.[地址_1] = c.[区地址] or t.[小区名_1] = c.[区地址] or t.[地址_1] = c.[小区名址])
|
||||
left join #TEMP_ODS_PROJECT_INFO d
|
||||
on LEFT(d.County,2)=LEFT(t.case_county,2) and (t.[小区名_1] = d.ProjectName or t.[地址_1] = d.ProjectAddr);
|
||||
|
||||
INSERT INTO #HousingCaseListAdj2ID
|
||||
SELECT HouseHoldsID_SRC, ProjectID_SRC, ProjectID, BuildingID
|
||||
FROM (
|
||||
SELECT ROW_NUMBER()OVER(PARTITION BY HouseHoldsID_SRC ORDER BY BuildingID DESC) SQ, A.*
|
||||
FROM #HousingCaseListAdj2ID_ZFZL A
|
||||
)T WHERE SQ=1;
|
||||
|
||||
|
||||
DROP TABLE #HousingCaseListAdj2ID_ZFZL
|
||||
DROP TABLE #HouseingCaseZFZL;
|
||||
|
||||
/****个性化:
|
||||
***** 总楼层为NULL,
|
||||
***** 1.用楼栋或小区主力楼栋的总层数补充
|
||||
***** 2.总楼层置为7,后面楼层系数修正时统一
|
||||
****/
|
||||
UPDATE A
|
||||
SET A.UpperFloorSum =
|
||||
CASE WHEN A.UpperFloorSum<>0 AND A.UpperFloorSum IS NOT NULL THEN A.UpperFloorSum
|
||||
WHEN C.[AI小区ID] IS NOT NULL THEN C.[地上层数]
|
||||
ELSE D.UpperFloorSum END
|
||||
FROM #HousingCaseListAdj A
|
||||
LEFT JOIN #HousingCaseListAdj2ID B
|
||||
ON A.HouseHoldsID_SRC = B.HouseHoldsID_SRC
|
||||
LEFT JOIN [AI楼栋基价201709] C
|
||||
ON B.ProjectID=C.[AI小区ID] AND B.BuildingID=C.[AI楼栋ID]
|
||||
LEFT JOIN #TEMP_ODS_PROJECT_INFO D
|
||||
ON B.ProjectID=D.ProjectID;
|
||||
|
||||
UPDATE #HousingCaseListAdj
|
||||
SET UpperFloorSum = 7
|
||||
WHERE UpperFloorSum IS NULL;
|
||||
|
||||
|
||||
|
||||
/***************************案例标准化*******************************/
|
||||
create table #HousingCaseListSTD
|
||||
(
|
||||
HouseholdsID_SRC nvarchar(64)
|
||||
, ProjectID_SRC nvarchar(64)
|
||||
, ProjectID bigint
|
||||
, BuildingID bigint
|
||||
, AreaCoff decimal(7, 4)
|
||||
, TowardsCoff decimal(7, 4)
|
||||
, FloorCoff decimal(7, 4)
|
||||
, DecorationRng int
|
||||
, YearCoff decimal(7, 4)
|
||||
, BuildingCoff decimal(7, 4)
|
||||
, RoomTypeCoff decimal(7, 4)
|
||||
, PriceUnit decimal(18, 2) not null
|
||||
, PriceScatterRent decimal(18, 2) --散租单价
|
||||
, PriceEntireRent decimal(18, 2) --整租单价
|
||||
, PriceShareRent0 decimal(18, 2) --合租单间价
|
||||
, PriceShareRent decimal(18, 2) --合租折算价
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO #HousingCaseListSTD
|
||||
SELECT A.HouseholdsID_SRC, A.ProjectID_SRC, B.ProjectID, B.BuildingID,
|
||||
D.CoefficientA*A.Area+D.CoefficientB as AreaCoff, a.TowardsCoff as TowardsCoff, F.Coefficient as FloorCoff,
|
||||
G.Coefficient as DecorationRng, 1 as YearCoff, I.Coefficient as BuildingCoff, J.Coefficient AS RoomTypeCoff, A.PriceUnit,
|
||||
(A.PriceUnit-isnull(G.Coefficient,0))*1.0/isnull(D.CoefficientA*A.Area+D.CoefficientB,1)/isnull(a.TowardsCoff,1)/isnull(F.Coefficient,1)/isnull(I.Coefficient,1)/isnull(J.Coefficient,1) PriceScatterRent,
|
||||
(A.PriceUnit-isnull(G.Coefficient,0))*1.0/isnull(D.CoefficientA*A.Area+D.CoefficientB,1)/isnull(a.TowardsCoff,1)/isnull(F.Coefficient,1)/isnull(I.Coefficient,1)/isnull(J.Coefficient,1)+isnull(G.Coefficient,0) PriceEntireRent,
|
||||
A.PriceTotal*1.0/isnull(F.Coefficient,1)/isnull(a.TowardsCoff,1) as PriceShareRent0,
|
||||
CASE WHEN A.Hall=0 THEN A.PriceTotal*A.Room*1.0/isnull(F.Coefficient,1)/isnull(a.TowardsCoff,1)
|
||||
ELSE A.PriceTotal*(A.Room+A.Hall-1)*1.0/isnull(F.Coefficient,1)/isnull(a.TowardsCoff,1) END AS PriceShareRent
|
||||
FROM #HousingCaseListAdj A
|
||||
LEFT JOIN #HousingCaseListAdj2ID B
|
||||
ON A.HouseholdsID_SRC = B.HouseholdsID_SRC
|
||||
left join (select CommunityId,ProjectLevel from obpm_LianCheng_Data.dbo.V_ResidenceCommunity ) C
|
||||
on B.ProjectID = C.CommunityId
|
||||
LEFT JOIN (SELECT * FROM DIM_PARAMETERS WHERE CoffType='面积修正(租金)' and ProjectType = '公寓') D --面积修正
|
||||
on C.ProjectLevel = D.ProjectLevel and ( A.Area > D.LowerKey and A.Area <= D.UpperKey)
|
||||
LEFT JOIN (SELECT * FROM DIM_PARAMETERS WHERE CoffType='楼层(租金)' and ProjectType = '公寓') F --楼层修正
|
||||
on isnull(A.Elevator,99)=isnull(F.Elevator,99) and A.UpperFloorSum = F.UpperKey and A.UpperFloorNum = F.LowerKey
|
||||
LEFT JOIN (SELECT * FROM DIM_PARAMETERS WHERE CoffType='室内装修(租金)' and ProjectType = '公寓') G --装修修正
|
||||
on A.Decoration = G.SingleKey
|
||||
LEFT JOIN DIM_BUILDING_COFF I
|
||||
on B.BuildingID = I.BuildingID
|
||||
LEFT JOIN (SELECT * FROM DIM_PARAMETERS WHERE CoffType='室加厅修正(租金)' and ProjectType = '公寓') J --室加厅修正
|
||||
on A.Room = J.UpperKey and A.Hall = J.LowerKey;
|
||||
|
||||
--当月拍照表调价信息(非首期)
|
||||
select
|
||||
a.HouseholdsID_SRC,
|
||||
case when b.Status is null then 3
|
||||
when a.PriceTotal=b.PriceTotal then 1
|
||||
else 2 end as Status,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedValue
|
||||
when b.Status is null then 0
|
||||
else a.PriceTotal-b.PriceTotal end AdjustedValue,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedPst
|
||||
when b.Status is null then 0
|
||||
else (a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotal end AdjustedPst,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValue
|
||||
when b.Status is null then 0
|
||||
else b.AdjustedCumValue + a.PriceTotal-b.PriceTotal end AdjustedCumValue,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPst
|
||||
when b.Status is null then 0
|
||||
else (b.AdjustedCumValue + a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotalIn end AdjustedCumPst,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValueAbs
|
||||
when b.Status is null then 0
|
||||
else b.AdjustedCumValueAbs + abs(a.PriceTotal-b.PriceTotal) end AdjustedCumValueAbs,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
|
||||
when b.Status is null then 0
|
||||
else (b.AdjustedCumValueAbs+ abs(a.PriceTotal-b.PriceTotal))*1.0/b.PriceTotalIn end AdjustedCumPstAbs,
|
||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
|
||||
when b.Status is null then 0
|
||||
else b.AdjustedCumNum+1 end AdjustedCumNum,
|
||||
case when b.Status is null then a.PriceTotal else b.PriceTotalIn end PriceTotalIn,
|
||||
NULL as PriceTotalOut,
|
||||
case when b.Status is not null then b.PriceDateIn
|
||||
when a.PriceDateIn is not null then a.PriceDateIn
|
||||
else getdate() end as PriceDateIn,
|
||||
cast(NULL as date) as PriceDateOut,
|
||||
case when b.Status is not null then b.Origin
|
||||
else a.Origin end as Origin
|
||||
into #HousingCaseListStatic
|
||||
from #HousingCaseListAdj a
|
||||
left join dbo.Ods_HousingCaseListed_RENT_#lastYearMonth# b
|
||||
on a.HouseholdsID_SRC = b.HouseholdsID_SRC;
|
||||
|
||||
/**************************插入案例到案例清洗表(非首期)***********************************/
|
||||
--新建当期案例清洗表
|
||||
|
||||
|
||||
--插入当月活跃案例数据
|
||||
insert into ODS_HOUSINGCASELISTED_RENT_#yearMonth#
|
||||
select a.HouseholdsID_SRC, a.ProjectID_SRC, b.ProjectID, b.BuildingID, a.RentType, a.Room, a.Hall, a.Bashroom,
|
||||
a.Area, a.Towards, a.UpperFloorSum, a.UpperFloorNum, a.Elevator, a.Decoration, a.[Year],
|
||||
b.AreaCoff, b.TowardsCoff, b.FloorCoff, b.DecorationRng, b.YearCoff, b.BuildingCoff, b.RoomTypeCoff,
|
||||
a.PriceTotal, a.PriceUnit, b.PriceScatterRent, b.PriceEntireRent, b.PriceShareRent0, b.PriceShareRent,
|
||||
a.Visited_Num, a.First_Visit_Time, a.Visited_Num_15, a.Visited_Num_30,
|
||||
c.Status, c.AdjustedValue, c.AdjustedPst, c.AdjustedCumValue, c.AdjustedCumPst, c.AdjustedCumValueAbs,
|
||||
c.AdjustedCumPstAbs, c.AdjustedCumNum, c.PriceTotalIn, c.PriceTotalOut, c.PriceDateIn, c.PriceDateOut,
|
||||
c.Origin, a.UrlHouseholds, a.UrlProjects, a.CaseName
|
||||
from #HousingCaseListAdj a
|
||||
left join #HousingCaseListSTD b
|
||||
on a.HouseholdsID_SRC = b.HouseholdsID_SRC
|
||||
left join #HousingCaseListStatic c
|
||||
on a.HouseholdsID_SRC = c.HouseholdsID_SRC;
|
||||
|
||||
--插入当月下架记录
|
||||
select a.HouseholdsID_SRC, a.ProjectID_SRC, a.ProjectID, a.BuildingID, a.RentType, a.Room, a.Hall, a.Bashroom,
|
||||
a.Area, a.Towards, a.UpperFloorSum, a.UpperFloorNum, a.Elevator, a.Decoration, a.[Year],
|
||||
a.AreaCoff, a.TowardsCoff, a.FloorCoff, a.DecorationRng, a.YearCoff, a.BuildingCoff, a.RoomTypeCoff,
|
||||
a.PriceTotal, a.PriceUnit, a.PriceScatterRent, a.PriceEntireRent, a.PriceShareRent0, a.PriceShareRent,
|
||||
a.Visited_Num, a.First_Visit_Time, a.Visited_Num_15, a.Visited_Num_30,
|
||||
4 as Status, a.AdjustedValue, a.AdjustedPst, a.AdjustedCumValue, a.AdjustedCumPst, a.AdjustedCumValueAbs,
|
||||
a.AdjustedCumPstAbs, a.AdjustedCumNum, a.PriceTotalIn, a.PriceTotal as PriceTotalOut, a.PriceDateIn, getdate() as PriceDateOut,
|
||||
a.Origin, a.UrlHouseholds, a.UrlProjects, a.CaseName
|
||||
into #TmpRecordAddCurr
|
||||
from ODS_HOUSINGCASELISTED_RENT_#lastYearMonth# a
|
||||
left join ODS_HOUSINGCASELISTED_RENT_#yearMonth# b
|
||||
on a.HouseholdsID_SRC = b.HouseholdsID_SRC
|
||||
where b.HouseholdsID_SRC is null and a.Status not in (4,5);
|
||||
|
||||
insert into ODS_HOUSINGCASELISTED_RENT_#yearMonth# select * from #TmpRecordAddCurr;
|
||||
|
||||
|
||||
--插入历史下架记录
|
||||
select a.HouseholdsID_SRC, a.ProjectID_SRC, a.ProjectID, a.BuildingID, a.RentType, a.Room, a.Hall, a.Bashroom,
|
||||
a.Area, a.Towards, a.UpperFloorSum, a.UpperFloorNum, a.Elevator, a.Decoration, a.[Year],
|
||||
a.AreaCoff, a.TowardsCoff, a.FloorCoff, a.DecorationRng, a.YearCoff, a.BuildingCoff, a.RoomTypeCoff,
|
||||
a.PriceTotal, a.PriceUnit, a.PriceScatterRent, a.PriceEntireRent, a.PriceShareRent0, a.PriceShareRent,
|
||||
a.Visited_Num, a.First_Visit_Time, a.Visited_Num_15, a.Visited_Num_30,
|
||||
5 as Status, a.AdjustedValue, a.AdjustedPst, a.AdjustedCumValue, a.AdjustedCumPst, a.AdjustedCumValueAbs,
|
||||
a.AdjustedCumPstAbs, a.AdjustedCumNum, a.PriceTotalIn, a.PriceTotal as PriceTotalOut, a.PriceDateIn, a.PriceDateOut,
|
||||
a.Origin, a.UrlHouseholds, a.UrlProjects, a.CaseName
|
||||
into #TmpRecordAddHis
|
||||
from ODS_HOUSINGCASELISTED_RENT_#lastYearMonth# a
|
||||
left join ODS_HOUSINGCASELISTED_RENT_#yearMonth# b
|
||||
on a.HouseholdsID_SRC = b.HouseholdsID_SRC
|
||||
where b.HouseholdsID_SRC is null and a.Status in (4,5);
|
||||
|
||||
insert into ODS_HOUSINGCASELISTED_RENT_#yearMonth# select * from #TmpRecordAddHis;
|
||||
|
||||
|
||||
drop table #HousingCaseListAdj
|
||||
drop table #HousingCaseListAdj2ID
|
||||
drop table #HousingCaseListSTD
|
||||
drop table #HousingCaseListStatic
|
||||
drop table #TmpRecordAddCurr
|
||||
drop table #TmpRecordAddHis
|
||||
drop table #HouseholdsID
|
||||
DROP TABLE #TEMP_ODS_PROJECT_INFO
|
@ -1,15 +1,10 @@
|
||||
--区县处理
|
||||
update ODS_OFFICECASELISTED_#yearMonth#_RAW
|
||||
update ODS_OFFICECASELISTED_#yearMonth#_RAW
|
||||
set [区域] = left([区域],2);
|
||||
|
||||
--楼盘名称中括号处理
|
||||
|
||||
update ODS_OFFICECASELISTED_#yearMonth#_RAW
|
||||
set [楼盘名称_M] = STUFF([楼盘名称], patindex('%(%',[楼盘名称]),patindex('%)%',[楼盘名称])-patindex('%(%',[楼盘名称])+1,'')
|
||||
|
||||
----索引匹配
|
||||
--搜房
|
||||
---(2019.07.09)删除DIM_OFFICE_PROJECTID_SF2AI 中同一BuildingID对应不同UnifiedID的记录
|
||||
select distinct a.SID,
|
||||
set [楼盘名称_M] = STUFF([楼盘名称], patindex('%(%',[楼盘名称]),patindex('%)%',[楼盘名称])-patindex('%(%',[楼盘名称])+1,'');
|
||||
|
||||
select distinct a.case_id,
|
||||
case when b.BuildingID_P is not null then b.BuildingID_P
|
||||
when c.BuildingID_P is not null then c.BuildingID_P
|
||||
else d.BuildingID_P end as BuildingID_P,
|
||||
@ -24,23 +19,16 @@ left join DIM_OFFICE_PROJECTID_SF2AI_201909 c
|
||||
on a.[来源]='房天下' and 'http:'+a.[楼盘网址] = c.Curl
|
||||
left join DIM_OFFICE_PROJECTID_SF2AI_201909 d
|
||||
on a.[来源]='房天下' and (a.[地址] =d.Address_SF or a.[地址] =d.AddressF_SF) and a.[区域] = d.Area_SF and a.[板块] = d.Block_SF
|
||||
where b.ID_SF is not null or c.ID_SF is not null or d.ID_SF is not null
|
||||
where b.ID_SF is not null or c.ID_SF is not null or d.ID_SF is not null;
|
||||
|
||||
--安居客
|
||||
select distinct a.SID, b.BuildingID_P, b.ProjectID_P
|
||||
select distinct a.case_id, b.BuildingID_P, b.ProjectID_P
|
||||
into #AddressMatchAJK
|
||||
from ODS_OFFICECASELISTED_#yearMonth#_RAW a
|
||||
left join DIM_OFFICE_PROJECTID_AJK2AI_201909 b
|
||||
on a.[来源]='安居客' and (a.[楼盘名称] = b.ProjectName_AJK or a.[楼盘名称_M] = b.ProjectName_AJK or a.[地址] = b.Address_AJK or a.[地址] = b.AddressF_AJK) and (a.[区域] = b.Area_AJK or a.[板块] = b.Block_AJK)
|
||||
where b.ID_AJK is not null;
|
||||
|
||||
----修正系数匹配及修正
|
||||
----价格(主力基价或租金)偏离幅度q:
|
||||
----1)有基价的案例:q=修正后案例单价/上期基价-1;
|
||||
--- 2)无基价的案例:q=修正后案例单价/(AVERAGE(上期修正案例均价,当期修正案例均价))-1
|
||||
--- //////20190620优化:1) 可用案例偏离幅度修改为6%。 2) 剔除不在DIM_OFFICE_PROJECT_BUILDING_201909 中的楼栋
|
||||
--- //////20200325优化:案例整合表中新增没有地址匹配到的案例
|
||||
|
||||
with ListedPriceAvg_1 as(
|
||||
select BuildingID_P, ProjectID_P, avg(ListedPrice) as ListedPrice_1, avg(ListedPriceRent) as ListedPriceRent_1
|
||||
from DW_OFFICECASE_COMM_#lastYearMonth#
|
||||
@ -55,7 +43,7 @@ coff as(
|
||||
else 1 end as DECIMAL(7,4)) as DecorationCoff
|
||||
from ODS_OFFICECASELISTED_#yearMonth#_RAW a
|
||||
left join (select * from #AddressMatchSF union select * from #AddressMatchAJK) b
|
||||
on a.SID = b.SID
|
||||
on a.case_id = b.case_id
|
||||
left join DIM_OFFICE_PROJECT_BUILDING_201909 c
|
||||
on b.BuildingID_P = c.BuildingID_P and c.EffDate <= getdate() AND c.ExpirDate > getdate()
|
||||
),
|
||||
@ -73,7 +61,7 @@ ListedPriceAvg_0_1 as(
|
||||
select BuildingID_P, ProjectID_P, ListedPrice as Price, ListedPriceRent as PriceRent from ListedPriceAvg
|
||||
) a group by BuildingID_P, ProjectID_P
|
||||
)
|
||||
select a.*, isnull(a.[单价],0)*1.0/FloorCoff/DecorationCoff as PriceAmend,
|
||||
select a.*, cast(isnull(a.[单价],0)*1.0/FloorCoff/DecorationCoff as decimal(18,6)) as PriceAmend,
|
||||
b.MainPrice MainPrice_1, b.MainPriceRent MainPriceRent_1,
|
||||
e.ListedPrice_1, e.ListedPriceRent_1, d.ListedPrice, d.ListedPriceRent,
|
||||
case when a.[分类]='售' and isnull(b.MainPrice,0)<>0 then isnull(a.[单价],0)*1.0/FloorCoff/DecorationCoff/b.MainPrice-1
|
||||
@ -87,7 +75,7 @@ left join (select BuildingID_P, ProjectID_P, MainPrice, MainPriceRent from ODS_O
|
||||
on a.BuildingID_P = b.BuildingID_P
|
||||
left join ListedPriceAvg_0_1 c on a.BuildingID_P = c.BuildingID_P
|
||||
left join ListedPriceAvg d on a.BuildingID_P = d.BuildingID_P
|
||||
left join ListedPriceAvg_1 e on a.BuildingID_P = e.BuildingID_P
|
||||
left join ListedPriceAvg_1 e on a.BuildingID_P = e.BuildingID_P;
|
||||
|
||||
alter table DW_OFFICECASE_COMM_#yearMonth# add VOPPT nvarchar(32);
|
||||
|
||||
@ -115,7 +103,7 @@ select BuildingID_P, ProjectID_P,
|
||||
Into #BuildingPriceWithCase
|
||||
from DW_OFFICECASE_COMM_#yearMonth# a
|
||||
where VOPPT in ('s:lte:6%','r:lte:6%')
|
||||
group by BuildingID_P, ProjectID_P, MainPrice_1, MainPriceRent_1
|
||||
group by BuildingID_P, ProjectID_P, MainPrice_1, MainPriceRent_1;
|
||||
|
||||
---绑定涨跌幅
|
||||
--绑定同一办公项目
|
||||
@ -137,8 +125,8 @@ left join (
|
||||
)b on a.ProjectID_P = b.ProjectID_P
|
||||
left join #BuildingPriceWithCase c
|
||||
on a.BuildingID_P= c.BuildingID_P
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate()
|
||||
go
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate();
|
||||
|
||||
|
||||
--竣工日期<=5年+同一办公分类+ 同一街道
|
||||
with BindStreet as(
|
||||
@ -147,26 +135,25 @@ with BindStreet as(
|
||||
inner join #TempBindUnifiedID b
|
||||
on abs(a.[Year]-b.[Year])<=5 and a.OfficeClass = b.OfficeClass and (a.OfficeClass is not null and a.OfficeClass<>'未确定') and a.Street = b.Street
|
||||
)
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
when b.MainPricePst is not null then b.MainPricePst end as MainPricePst,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
when b.MainPriceRentPst is not null then b.MainPriceRentPst end as MainPriceRentPst,
|
||||
case when c.MainPricePst is not null then c.MainPriceType
|
||||
when b.MainPricePst is not null then 't1' end as MainPriceType,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't1' end as MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't1' end as MainPriceRentType
|
||||
into #TempBindStreet
|
||||
from DIM_OFFICE_PROJECT_BUILDING_201909 a
|
||||
left join (
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
from BindStreet group by BuildingID_P, ProjectID_P
|
||||
) b on a.BuildingID_P = b.BuildingID_P
|
||||
left join #TempBindUnifiedID c
|
||||
on a.BuildingID_P= c.BuildingID_P
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate()
|
||||
go
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate();
|
||||
|
||||
--竣工日期<=5年+同一办公分类+ 同一板块
|
||||
with BindBlock as(
|
||||
@ -175,26 +162,25 @@ with BindBlock as(
|
||||
inner join #TempBindStreet b
|
||||
on abs(a.[Year]-b.[Year])<=5 and a.OfficeClass = b.OfficeClass and (a.OfficeClass is not null and a.OfficeClass<>'未确定') and a.Block = b.Block
|
||||
)
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
when b.MainPricePst is not null then b.MainPricePst end as MainPricePst,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
when b.MainPriceRentPst is not null then b.MainPriceRentPst end as MainPriceRentPst,
|
||||
case when c.MainPricePst is not null then c.MainPriceType
|
||||
when b.MainPricePst is not null then 't2' end as MainPriceType,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't2' end as MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't2' end as MainPriceRentType
|
||||
into #TempBindBlock
|
||||
from DIM_OFFICE_PROJECT_BUILDING_201909 a
|
||||
left join (
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
from BindBlock group by BuildingID_P, ProjectID_P
|
||||
) b on a.BuildingID_P = b.BuildingID_P
|
||||
left join #TempBindStreet c
|
||||
on a.BuildingID_P= c.BuildingID_P
|
||||
where(b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate()
|
||||
go
|
||||
where(b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate();
|
||||
|
||||
--竣工日期<=5年+同一办公分类+ 同一区域
|
||||
with BindCounty as(
|
||||
@ -203,26 +189,26 @@ with BindCounty as(
|
||||
inner join #TempBindBlock b
|
||||
on abs(a.[Year]-b.[Year])<=5 and a.OfficeClass = b.OfficeClass and (a.OfficeClass is not null and a.OfficeClass<>'未确定') and a.County = b.County
|
||||
)
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
when b.MainPricePst is not null then b.MainPricePst end as MainPricePst,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
when b.MainPriceRentPst is not null then b.MainPriceRentPst end as MainPriceRentPst,
|
||||
case when c.MainPricePst is not null then c.MainPriceType
|
||||
when b.MainPricePst is not null then 't3' end as MainPriceType,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't3' end as MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't3' end as MainPriceRentType
|
||||
into #TempBindCounty
|
||||
from DIM_OFFICE_PROJECT_BUILDING_201909 a
|
||||
left join (
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
from BindCounty group by BuildingID_P, ProjectID_P
|
||||
) b on a.BuildingID_P = b.BuildingID_P
|
||||
left join #TempBindBlock c
|
||||
on a.BuildingID_P= c.BuildingID_P
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate()
|
||||
go
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate();
|
||||
|
||||
|
||||
--竣工日期<=5年+同一办公分类+ 同一环线
|
||||
with BindLoop as(
|
||||
@ -231,30 +217,29 @@ with BindLoop as(
|
||||
inner join #TempBindCounty b
|
||||
on abs(a.[Year]-b.[Year])<=5 and a.OfficeClass = b.OfficeClass and (a.OfficeClass is not null and a.OfficeClass<>'未确定') and a.Loop = b.Loop
|
||||
)
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
select a.BuildingID_P, a.ProjectID_P, a.ProjectName, a.ProjectAddr, a.BuildingAddr, a.County, a.Loop, a.Block, a.Street,
|
||||
a.[Year], a.AvgArea, a.TotalFloorSum, a.UpperFloorSum, a.OfficeClass, a.Grade,
|
||||
case when c.MainPricePst is not null then c.MainPricePst
|
||||
when b.MainPricePst is not null then b.MainPricePst end as MainPricePst,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentPst
|
||||
when b.MainPriceRentPst is not null then b.MainPriceRentPst end as MainPriceRentPst,
|
||||
case when c.MainPricePst is not null then c.MainPriceType
|
||||
when b.MainPricePst is not null then 't4' end as MainPriceType,
|
||||
case when c.MainPriceRentPst is not null then c.MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't4' end as MainPriceRentType
|
||||
when b.MainPriceRentPst is not null then 't4' end as MainPriceRentType
|
||||
into #TempBindLoop
|
||||
from DIM_OFFICE_PROJECT_BUILDING_201909 a
|
||||
left join (
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
select BuildingID_P, ProjectID_P, avg(MainPricePst) MainPricePst, avg(MainPriceRentPst) MainPriceRentPst
|
||||
from BindLoop group by BuildingID_P, ProjectID_P
|
||||
) b on a.BuildingID_P = b.BuildingID_P
|
||||
left join #TempBindCounty c
|
||||
on a.BuildingID_P= c.BuildingID_P
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate()
|
||||
go
|
||||
where (b.ProjectID_P is not null or c.BuildingID_P is not null) and a.EffDate <= getdate() AND a.ExpirDate > getdate();
|
||||
|
||||
---添加上期基价
|
||||
---///非t~t4,且上期价格非空,且上期价格类型非t5,则另当期基价类型为t5
|
||||
select newid() as id
|
||||
select row_number() over( order by newid() ) id
|
||||
, a.BuildingID
|
||||
, a.UnifiedID
|
||||
, a.ProjectID
|
||||
|
@ -7,20 +7,38 @@ select a.BuildingID_p, a.ProjectID_p, a.MainPrice, a.MainPriceRent, a.MainPrice_
|
||||
into #InfoChg
|
||||
from DWA_PROJECTBASEPRICE_OFFICE_MANU_#yearMonth# a
|
||||
left join ODS_OFFICE_BUILDING_PRICE_INFO_#yearMonth# b
|
||||
on a.BuildingID = b.BuildingID and b.status=1 and (
|
||||
on a.BuildingID_p = b.BuildingID_p and b.status=1 and (
|
||||
cast(a.MainPrice as decimal(18,1)) <> cast(isnull(b.MainPrice, 0) as decimal(18,1)) or
|
||||
cast(a.MainPriceRent as decimal(18,1)) <> cast(isnull(b.MainPriceRent, 0) as decimal(18,1)))
|
||||
left join ODS_OFFICE_BUILDING_PRICE_INFO_#lastYearMonth# c
|
||||
on a.BuildingID = c.BuildingID and c.status=1 and (
|
||||
on a.BuildingID_p = c.BuildingID_p and c.status=1 and (
|
||||
cast(a.MainPrice_1 as decimal(18,1)) <> cast(isnull(c.MainPrice, 0) as decimal(18,1)) or
|
||||
cast(a.MainPriceRent_1 as decimal(18,1)) <> cast(isnull(c.MainPriceRent, 0) as decimal(18,1)))
|
||||
where b.BuildingID is not null or c.BuildingID is not null;
|
||||
where b.BuildingID_p is not null or c.BuildingID is not null;
|
||||
|
||||
--价格调整
|
||||
select a.BuildingID, a.UnifiedID, a.ProjectID, a.BuildingID_P, a.ProjectID_P, b.MainPrice_1, b.MainPriceRent_1,
|
||||
select a.BuildingID, a.UnifiedID, a.ProjectID, a.BuildingID_P, a.ProjectID_P, b.MainPrice_1 as MainPrice, b.MainPriceRent_1 as MainPriceRent,
|
||||
a.MainPricePst, a.MainPriceRentPst,
|
||||
a.MainPriceType, a.MainPriceRentType, b.ModifyDate, 1 as Status, a.BuildingStd,
|
||||
case when MainPrice_1Chg=0 then '' else 'MainPrice_1Chg|' end + case when MainPriceRent_1Chg=0 then '' else 'MainPriceRent_1Chg|' end as AdjEvd
|
||||
, a.MainPrice_1
|
||||
, a.MainPriceRent_1
|
||||
, a.AreaCoff
|
||||
, a.YearCoff
|
||||
, a.BuildingCoff
|
||||
, a.ProjectName
|
||||
, a.ProjectAddr
|
||||
, a.BuildingAddr
|
||||
, a.County
|
||||
, a.Loop
|
||||
, a.Block
|
||||
, a.Street
|
||||
, a.Year
|
||||
, a.AvgArea
|
||||
, a.TotalFloorSum
|
||||
, a.UpperFloorSum
|
||||
, a.OfficeClass
|
||||
, a.Grade
|
||||
into #InfoChgLst
|
||||
from ODS_OFFICE_BUILDING_PRICE_INFO_#lastYearMonth# a
|
||||
inner join #InfoChg b
|
||||
@ -36,8 +54,7 @@ where b.BuildingID_p is not null and a.status=1;
|
||||
|
||||
insert into ODS_OFFICE_BUILDING_PRICE_INFO_#lastYearMonth#
|
||||
(
|
||||
id
|
||||
, BuildingID
|
||||
BuildingID
|
||||
, UnifiedID
|
||||
, ProjectID
|
||||
, BuildingID_P
|
||||
@ -72,8 +89,7 @@ insert into ODS_OFFICE_BUILDING_PRICE_INFO_#lastYearMonth#
|
||||
, Grade
|
||||
)
|
||||
select
|
||||
newid()
|
||||
, BuildingID
|
||||
BuildingID
|
||||
, UnifiedID
|
||||
, ProjectID
|
||||
, BuildingID_P
|
||||
@ -113,6 +129,24 @@ select a.BuildingID, a.UnifiedID, a.ProjectID, a.BuildingID_P, a.ProjectID_P, b.
|
||||
b.MainPrice*1.0/c.MainPrice as MainPricePst, b.MainPriceRent*1.0/c.MainPriceRent as MainPriceRentPst,
|
||||
a.MainPriceType, a.MainPriceRentType, b.ModifyDate, 1 as Status, a.BuildingStd,
|
||||
case when MainPriceChg=0 then '' else 'MainPriceChg|' end + case when MainPriceRentChg=0 then '' else 'MainPriceRentChg|' end as AdjEvd
|
||||
, c.MainPrice_1
|
||||
, c.MainPriceRent_1
|
||||
, a.AreaCoff
|
||||
, a.YearCoff
|
||||
, a.BuildingCoff
|
||||
, a.ProjectName
|
||||
, a.ProjectAddr
|
||||
, a.BuildingAddr
|
||||
, a.County
|
||||
, a.Loop
|
||||
, a.Block
|
||||
, a.Street
|
||||
, a.Year
|
||||
, a.AvgArea
|
||||
, a.TotalFloorSum
|
||||
, a.UpperFloorSum
|
||||
, a.OfficeClass
|
||||
, a.Grade
|
||||
into #InfoChgCurr
|
||||
from ODS_OFFICE_BUILDING_PRICE_INFO_#yearMonth# a
|
||||
inner join #InfoChg b
|
||||
@ -130,8 +164,7 @@ where b.BuildingID_p is not null and a.status=1;
|
||||
|
||||
insert into dbo.ODS_OFFICE_BUILDING_PRICE_INFO_#yearMonth#
|
||||
(
|
||||
id
|
||||
, BuildingID
|
||||
BuildingID
|
||||
, UnifiedID
|
||||
, ProjectID
|
||||
, BuildingID_P
|
||||
@ -166,8 +199,7 @@ insert into dbo.ODS_OFFICE_BUILDING_PRICE_INFO_#yearMonth#
|
||||
, Grade
|
||||
)
|
||||
select
|
||||
newid()
|
||||
, BuildingID
|
||||
BuildingID
|
||||
, UnifiedID
|
||||
, ProjectID
|
||||
, BuildingID_P
|
||||
|
Reference in New Issue
Block a user