From 706dddeedd97f26c91413cabf31675d627a352b8 Mon Sep 17 00:00:00 2001 From: purple Date: Fri, 3 Jul 2020 18:52:11 +0800 Subject: [PATCH] =?UTF-8?q?feature=20(=E5=8A=9E=E5=85=AC=E5=9F=BA=E4=BB=B7?= =?UTF-8?q?=E8=BF=81=E7=A7=BB)=EF=BC=9A=20=E5=AE=8C=E6=88=90=E5=8A=9E?= =?UTF-8?q?=E5=85=AC=E8=AE=A1=E4=BB=B7=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 办公案例下载 2. 办公案例清洗 3. 办公基价计算 4. 办公基价导入 5. 物业基价菜单调整 6. 住宅租赁挂牌案例下载 7. 住宅租赁案例清洗 --- .../api/data/artificialResidenceSalePrice.js | 10 +- .../src/api/data/computeResidenceSalePrice.js | 14 + ruoyi-ui/src/views/data/price/BasePrice.vue | 166 +------- .../data/price/ComputeResidenceSalePrice.vue | 111 +++-- .../data/price/DistrictBlockChangeChart.vue | 86 ++++ .../data/price/UltimateOfficeBasePrice.vue | 36 +- ruoyi/sql/office_price.sql | 58 +++ .../data/basis/domain/UVBasePrice.java | 10 +- .../data/cases/domain/OriginalOfficeCase.java | 18 +- ...ginalResidencePlatformRentOpeningCase.java | 17 + .../OriginalResidenceRentOpeningCase.java | 14 +- .../OriginalResidenceSaleOpeningCase.java | 7 +- .../mapper/OriginalOfficeCaseMapper.java | 15 +- ...riginalResidenceRentOpeningCaseMapper.java | 8 + ...iginalResidenceRentPlatformCaseMapper.java | 5 +- .../impl/OriginalOfficeCaseServiceImpl.java | 28 +- ...alResidenceRentClosingCaseServiceImpl.java | 222 +++++----- ...alResidenceRentOpeningCaseServiceImpl.java | 95 +++-- .../price/controller/BasePriceController.java | 23 +- .../ResidenceSaleBasePriceController.java | 29 +- .../price/domain/DistrictBlockChange.java | 24 ++ .../price/domain/UltimateOfficeBasePrice.java | 11 + .../ComputeResidenceSalePriceMapper.java | 18 + .../mapper/UltimateOfficeBasePriceMapper.java | 12 + .../IComputeResidenceSalePriceService.java | 19 +- .../ComputeResidenceSalePriceServiceImpl.java | 11 + .../UltimateOfficeBasePriceServiceImpl.java | 174 +++++++- ruoyi/src/main/resources/application.yml | 2 +- .../data/ComputeResidenceSalePriceMapper.xml | 33 +- .../data/DownloadOriginalOfficeCaseMapper.xml | 18 +- ...OriginalResidenceRentOpeningCaseMapper.xml | 5 +- ...riginalResidenceRentPlatformCaseMapper.xml | 7 +- .../mybatis/data/OriginalOfficeCaseMapper.xml | 187 ++++++--- ...OriginalResidenceRentOpeningCaseMapper.xml | 289 ++++++++----- .../data/UltimateOfficeBasePriceMapper.xml | 35 +- .../data/UltimateResidenceSalePriceMapper.xml | 2 +- .../sql-template/clear_rent_closing_case.sql | 0 .../sql-template/clear_rent_opening_case.sql | 384 ++++++++++++++++++ .../sql-template/compute_office_price.sql | 101 ++--- .../sql-template/compute_rent_price.sql | 0 .../sql-template/update_office_price.sql | 56 ++- .../compute/OfficeBasePriceTests.java | 35 ++ .../compute/ResidenceRentBasePriceTests.java | 45 +- 43 files changed, 1759 insertions(+), 681 deletions(-) create mode 100644 ruoyi-ui/src/views/data/price/DistrictBlockChangeChart.vue create mode 100644 ruoyi/sql/office_price.sql create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidencePlatformRentOpeningCase.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/price/domain/DistrictBlockChange.java create mode 100644 ruoyi/src/main/resources/sql-template/clear_rent_closing_case.sql create mode 100644 ruoyi/src/main/resources/sql-template/clear_rent_opening_case.sql create mode 100644 ruoyi/src/main/resources/sql-template/compute_rent_price.sql create mode 100644 ruoyi/src/test/java/com/uvaluation/compute/OfficeBasePriceTests.java diff --git a/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js b/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js index d28fe2914..238cf1f96 100644 --- a/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js +++ b/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询住宅销售基价修正列表 export function list(query) { return request({ - url: '/data/sale-price/residence/ultimate/list', + url: '/data/sale-price/residence/artificial/list', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function list(query) { // 查询住宅销售基价修正详细 // export function get(id) { // return request({ -// url: '/data/sale-price/residence/ultimate/' + id, +// url: '/data/sale-price/residence/artificial/' + id, // method: 'get' // }) // } @@ -20,7 +20,7 @@ export function list(query) { // // 修改住宅销售基价修正 // export function update(data) { // return request({ -// url: '/data/sale-price/residence/ultimate', +// url: '/data/sale-price/residence/artificial', // method: 'put', // data: data // }) @@ -29,7 +29,7 @@ export function list(query) { // 导出住宅销售基价修正 export function export2File(query) { return request({ - url: '/data/sale-price/residence/ultimate/export', + url: '/data/sale-price/residence/artificial/export', method: 'get', params: query }) @@ -37,7 +37,7 @@ export function export2File(query) { export function getYearMonthList() { return request({ - url: '/data/sale-price/residence/ultimate/yearmonth', + url: '/data/sale-price/residence/artificial/yearmonth', method: 'get' }) } diff --git a/ruoyi-ui/src/api/data/computeResidenceSalePrice.js b/ruoyi-ui/src/api/data/computeResidenceSalePrice.js index 3c5264175..5324a7fe2 100644 --- a/ruoyi-ui/src/api/data/computeResidenceSalePrice.js +++ b/ruoyi-ui/src/api/data/computeResidenceSalePrice.js @@ -41,3 +41,17 @@ export function getYearMonthList() { method: 'get' }) } + +export function getBlockChange(yearmonth) { + return request({ + url: '/data/sale-price/residence/compute/block-change/' + yearmonth, + method: 'get' + }) +} + +export function getCountyChange(yearmonth) { + return request({ + url: '/data/sale-price/residence/compute/county-change/' + yearmonth, + method: 'get' + }) +} diff --git a/ruoyi-ui/src/views/data/price/BasePrice.vue b/ruoyi-ui/src/views/data/price/BasePrice.vue index 4345a2307..2a234034e 100644 --- a/ruoyi-ui/src/views/data/price/BasePrice.vue +++ b/ruoyi-ui/src/views/data/price/BasePrice.vue @@ -1,17 +1,17 @@ - @@ -262,7 +135,7 @@ export default { communityType: undefined, priceType: undefined, valuePoint: undefined, - pageNum: 1, + pageIndex: 1, pageSize: 10 }, yearMonthList: [], @@ -301,9 +174,6 @@ export default { }, created() { this.loading = false; - // getYearMonthList().then(response => { - // this.yearMonthList = response.data; - // }); }, methods: { priceTypeFormatter: function(row, column, cellValue, index) { @@ -365,7 +235,7 @@ export default { }, /** 搜索按钮操作 */ handleQuery() { - this.queryParams.pageNum = 1; + this.queryParams.pageIndex = 1; this.getList(); }, /** 重置按钮操作 */ @@ -379,12 +249,6 @@ export default { this.single = selection.length != 1; this.multiple = !selection.length; }, - /** 新增按钮操作 */ - // handleAdd() { - // this.reset(); - // this.open = true; - // this.title = "添加办公基价"; - // }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); @@ -409,16 +273,6 @@ export default { this.msgError(response.msg); } }); - } else { - // addUltimate(this.form).then(response => { - // if (response.code === 200) { - // this.msgSuccess("新增成功"); - // this.open = false; - // this.getList(); - // } else { - // this.msgError(response.msg); - // } - // }); } } }); @@ -426,7 +280,7 @@ export default { /** 导出按钮操作 */ handleExport() { const queryParams = this.queryParams; - this.$confirm("是否确认导出所有住宅租赁基价数据项?", "警告", { + this.$confirm("确认导出物业基价?", "警告", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" diff --git a/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue b/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue index 9d42a4245..8e6b3ee4c 100644 --- a/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue +++ b/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue @@ -45,6 +45,24 @@ v-hasPermi="['system:user:export']" >导出 + + 板块涨跌幅 + + + 区域涨跌幅 + @@ -120,24 +138,6 @@ - - - + + + + diff --git a/ruoyi-ui/src/views/data/price/UltimateOfficeBasePrice.vue b/ruoyi-ui/src/views/data/price/UltimateOfficeBasePrice.vue index 92fc962c0..353d4c146 100644 --- a/ruoyi-ui/src/views/data/price/UltimateOfficeBasePrice.vue +++ b/ruoyi-ui/src/views/data/price/UltimateOfficeBasePrice.vue @@ -18,16 +18,16 @@ - + + + + + + + 搜索 重置 @@ -62,7 +68,7 @@ size="mini" @click="handleImport" v-hasPermi="['system:user:import']" - >导入 + >文件导入 - - - - - - - + + + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/DownloadOriginalOfficeCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalOfficeCaseMapper.xml index e10894936..9169deb09 100644 --- a/ruoyi/src/main/resources/mybatis/data/DownloadOriginalOfficeCaseMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalOfficeCaseMapper.xml @@ -11,7 +11,7 @@ - + @@ -32,17 +32,19 @@ - - + + + diff --git a/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceRentOpeningCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceRentOpeningCaseMapper.xml index 58f8407f5..f3f4b26b8 100644 --- a/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceRentOpeningCaseMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceRentOpeningCaseMapper.xml @@ -24,11 +24,12 @@ + - select 面积 + select top 100 面积 ,block ,地址 ,小区名 @@ -32,7 +32,6 @@ ,楼层 ,厅数 ,编号 - ,type ,price ,区域 ,出租方式 @@ -40,6 +39,6 @@ ,来源 ,savetime FROM dbo.挂牌房源 - where savetime ]]> #{startDate} and savetime #{endDate} + where savetime ]]> #{startDate,jdbcType=DATE} and savetime #{endDate,jdbcType=DATE} \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/OriginalOfficeCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/OriginalOfficeCaseMapper.xml index 9dfd44121..96879f40a 100644 --- a/ruoyi/src/main/resources/mybatis/data/OriginalOfficeCaseMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/OriginalOfficeCaseMapper.xml @@ -6,43 +6,43 @@ 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 ); @@ -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 ); + + + + 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 + ) + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/OriginalResidenceRentOpeningCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceRentOpeningCaseMapper.xml index fb961fc84..be025bece 100644 --- a/ruoyi/src/main/resources/mybatis/data/OriginalResidenceRentOpeningCaseMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceRentOpeningCaseMapper.xml @@ -5,122 +5,191 @@ - + 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 ); - - - +-- 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 +-- ); + + + + 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 + ) + + + + 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) ); @@ -266,14 +335,14 @@ - + 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) diff --git a/ruoyi/src/main/resources/mybatis/data/UltimateOfficeBasePriceMapper.xml b/ruoyi/src/main/resources/mybatis/data/UltimateOfficeBasePriceMapper.xml index 05197acb2..525767135 100644 --- a/ruoyi/src/main/resources/mybatis/data/UltimateOfficeBasePriceMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/UltimateOfficeBasePriceMapper.xml @@ -88,6 +88,16 @@ AND a.STATUS = #{status} + + AND a.BuildingStd = #{isStandardBuilding} + + + AND ( + a.ProjectName like concat('%', #{nameOrAddress} ,'%') or + a.ProjectAddr like concat('%', #{nameOrAddress} ,'%') or + a.BuildingAddr like concat('%', #{nameOrAddress} ,'%') + ) + @@ -104,8 +114,17 @@ AND a.STATUS = #{status} + + AND a.BuildingStd = #{isStandardBuilding} + + + AND ( + a.ProjectName like concat('%', #{nameOrAddress} ,'%') or + a.ProjectAddr like concat('%', #{nameOrAddress} ,'%') or + a.BuildingAddr like concat('%', #{nameOrAddress} ,'%') + ) + - order by a.id desc OFFSET #{pageIndex} rows fetch next #{pageSize} rows only; @@ -293,4 +312,18 @@ from ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth} where id=#{id}; + + IF OBJECT_ID('BatchImportOfArtificialOfficePrice', 'P') IS NOT NULL + drop procedure BatchImportOfArtificialOfficePrice; + + + + 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; + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/UltimateResidenceSalePriceMapper.xml b/ruoyi/src/main/resources/mybatis/data/UltimateResidenceSalePriceMapper.xml index 6f4279eda..ab87c1f26 100644 --- a/ruoyi/src/main/resources/mybatis/data/UltimateResidenceSalePriceMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/UltimateResidenceSalePriceMapper.xml @@ -74,7 +74,7 @@ \ No newline at end of file diff --git a/ruoyi/src/main/resources/sql-template/clear_rent_closing_case.sql b/ruoyi/src/main/resources/sql-template/clear_rent_closing_case.sql new file mode 100644 index 000000000..e69de29bb diff --git a/ruoyi/src/main/resources/sql-template/clear_rent_opening_case.sql b/ruoyi/src/main/resources/sql-template/clear_rent_opening_case.sql new file mode 100644 index 000000000..cc1b26f81 --- /dev/null +++ b/ruoyi/src/main/resources/sql-template/clear_rent_opening_case.sql @@ -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 \ No newline at end of file diff --git a/ruoyi/src/main/resources/sql-template/compute_office_price.sql b/ruoyi/src/main/resources/sql-template/compute_office_price.sql index 686f15e3b..763df5798 100644 --- a/ruoyi/src/main/resources/sql-template/compute_office_price.sql +++ b/ruoyi/src/main/resources/sql-template/compute_office_price.sql @@ -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 diff --git a/ruoyi/src/main/resources/sql-template/compute_rent_price.sql b/ruoyi/src/main/resources/sql-template/compute_rent_price.sql new file mode 100644 index 000000000..e69de29bb diff --git a/ruoyi/src/main/resources/sql-template/update_office_price.sql b/ruoyi/src/main/resources/sql-template/update_office_price.sql index 64d569173..eb521c5ba 100644 --- a/ruoyi/src/main/resources/sql-template/update_office_price.sql +++ b/ruoyi/src/main/resources/sql-template/update_office_price.sql @@ -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 diff --git a/ruoyi/src/test/java/com/uvaluation/compute/OfficeBasePriceTests.java b/ruoyi/src/test/java/com/uvaluation/compute/OfficeBasePriceTests.java new file mode 100644 index 000000000..a38ac063b --- /dev/null +++ b/ruoyi/src/test/java/com/uvaluation/compute/OfficeBasePriceTests.java @@ -0,0 +1,35 @@ +package com.uvaluation.compute; + +import com.ruoyi.RuoYiApplication; +import com.ruoyi.project.data.cases.service.IOriginalOfficeCaseService; +import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService; +import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; +import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import java.math.BigDecimal; +import java.util.LinkedList; +import java.util.List; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RuoYiApplication.class) +@ActiveProfiles("uat") +public class OfficeBasePriceTests { + + @Autowired + private IOriginalOfficeCaseService originalOfficeCaseService; + + /** + * 下载案例并且作价 + */ + @Test + public void testCompute() { + originalOfficeCaseService.compute(); + } +} diff --git a/ruoyi/src/test/java/com/uvaluation/compute/ResidenceRentBasePriceTests.java b/ruoyi/src/test/java/com/uvaluation/compute/ResidenceRentBasePriceTests.java index e94cee608..376010741 100644 --- a/ruoyi/src/test/java/com/uvaluation/compute/ResidenceRentBasePriceTests.java +++ b/ruoyi/src/test/java/com/uvaluation/compute/ResidenceRentBasePriceTests.java @@ -1,6 +1,7 @@ package com.uvaluation.compute; import com.ruoyi.RuoYiApplication; +import com.ruoyi.project.data.cases.service.IOriginalResidenceRentClosingCaseService; import com.ruoyi.project.data.cases.service.IOriginalResidenceRentOpeningCaseService; import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService; import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService; @@ -10,6 +11,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import java.math.BigDecimal; @@ -18,33 +20,22 @@ import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest(classes = RuoYiApplication.class) +@ActiveProfiles("uat") public class ResidenceRentBasePriceTests { -// -// @Autowired -// private IOriginalResidenceRentOpeningCaseService originalResidenceRentOpeningCaseService; -// @Autowired -// private IArtificialResidenceSalePriceService artificialResidenceSalePriceService; -// @Autowired -// private IOriginalResidenceSaleClosingCaseService originalResidenceClosingCaseService; -// -// @Test -// public void testClearOpeningCase() { -// originalResidenceRentOpeningCaseService.pullData(); -// } -// -// @Test -// public void testClearClosingCase() { -// originalResidenceClosingCaseService.clear(); -// } -// -// @Test -// public void testBatchImport() { -// List list = new LinkedList<>(); -// ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice = new ComputeResidenceSaleBasePrice(); -// computeResidenceSaleBasePrice.setCommunityId("10101"); -// computeResidenceSaleBasePrice.setBasePriceDraft(new BigDecimal(12222)); -// list.add(computeResidenceSaleBasePrice); -// artificialResidenceSalePriceService.batchImport(202007, list); -// } + + @Autowired + private IOriginalResidenceRentOpeningCaseService originalResidenceRentOpeningCaseService; + @Autowired + private IOriginalResidenceRentClosingCaseService originalResidenceRentClosingCaseService; + + @Test + public void testClearOpeningCase() { + originalResidenceRentOpeningCaseService.pullData(); + } + + @Test + public void testClearClosingCase() { + originalResidenceRentClosingCaseService.pullData(); + } }