@@ -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 @@
+
@@ -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 @@
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
\ 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();
+ }
}