feature (办公作价): 推送作价数据

1. 创建案例表
2. 推送案例数据
3. 创建价格表(备份上期价格表)
4. 推送价格数据
This commit is contained in:
purple 2020-07-09 11:18:08 +08:00
parent 482fefebfd
commit 2b28b51717
8 changed files with 205 additions and 165 deletions

View File

@ -8,7 +8,6 @@ import java.math.BigDecimal;
import java.util.Date;
/**
*
* @author purple
* @date 2020-05-20
*/
@ -22,6 +21,7 @@ public class UltimateOfficeBasePrice extends BaseEntity {
private Integer yearMonth;
@JSONField(serialize = false)
private Integer lastYearMonth;
@Excel(name = "楼栋ID-平台")
private String buildingId;
@Excel(name = "小区ID-平台")
@ -74,19 +74,23 @@ public class UltimateOfficeBasePrice extends BaseEntity {
private BigDecimal yearCoefficient;
@Excel(name = "基价楼栋系数")
private BigDecimal buildingCoefficient;
// @Excel(name = "更新日期")
// @Excel(name = "更新日期")
private Date updateDate;
// @Excel(name = "状态")
// @Excel(name = "状态")
private Boolean status;
@Excel(name = "是否标准楼栋")
private Boolean standardBuilding;
// @Excel(name = "更改价格说明")
// @Excel(name = "更改价格说明")
private String adjustPriceComment;
/**
* 名称或者地址
*/
private String nameOrAddress;
private String deprecatedBuildingId;
private String deprecatedCommunityId;
private String unifiedId;
public Integer getLastYearMonth() {
return lastYearMonth;
}
@ -374,4 +378,29 @@ public class UltimateOfficeBasePrice extends BaseEntity {
public void setNameOrAddress(String nameOrAddress) {
this.nameOrAddress = nameOrAddress;
}
public String getDeprecatedBuildingId() {
return deprecatedBuildingId;
}
public void setDeprecatedBuildingId(String deprecatedBuildingId) {
this.deprecatedBuildingId = deprecatedBuildingId;
}
public String getDeprecatedCommunityId() {
return deprecatedCommunityId;
}
public void setDeprecatedCommunityId(String deprecatedCommunityId) {
this.deprecatedCommunityId = deprecatedCommunityId;
}
public String getUnifiedId() {
return unifiedId;
}
public void setUnifiedId(String unifiedId) {
this.unifiedId = unifiedId;
}
}

View File

@ -235,6 +235,13 @@ public class UltimateOfficeBasePriceServiceImpl implements IUltimateOfficeBasePr
.replace("#today#", priceDate)
.replace("#lastMonth#", lastPriceDate);
jdbcTemplate.update(sql);
Calendar calendar = Calendar.getInstance();
calendar.setTime(lastValuePoint);
calendar.add(Calendar.MONTH, -1);
Integer lastPriceTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
pushData(yearMonth, lastYearMonth, lastPriceTableRoute);
}
/**
@ -250,6 +257,7 @@ public class UltimateOfficeBasePriceServiceImpl implements IUltimateOfficeBasePr
syncOfficeAggregationCaseMapper.createAggregationCaseTable(currentPriceTableRoute);
List<OfficeAggregationCase> list = originalOfficeCaseMapper.getOfficeAggregationCases(yearMonth);
list.parallelStream().forEach(officeAggregationCase -> {
officeAggregationCase.setYearMonth(currentPriceTableRoute);
syncOfficeAggregationCaseMapper.insertAggregationCase(officeAggregationCase);
});
@ -258,6 +266,7 @@ public class UltimateOfficeBasePriceServiceImpl implements IUltimateOfficeBasePr
List<UltimateOfficeBasePrice> ultimateOfficeBasePrices =
ultimateOfficeBasePriceMapper.getUltimateOfficeBasePrices(yearMonth);
ultimateOfficeBasePrices.parallelStream().forEach(ultimateOfficeBasePrice -> {
ultimateOfficeBasePrice.setYearMonth(currentPriceTableRoute);
syncOfficeAggregationCaseMapper.insertUltimatePriceTable(ultimateOfficeBasePrice);
});
@ -272,6 +281,7 @@ public class UltimateOfficeBasePriceServiceImpl implements IUltimateOfficeBasePr
List<UltimateOfficeBasePrice> lastUltimateOfficeBasePrices =
ultimateOfficeBasePriceMapper.getUltimateOfficeBasePrices(lastPriceTableRoute);
lastUltimateOfficeBasePrices.parallelStream().forEach(ultimateOfficeBasePrice -> {
ultimateOfficeBasePrice.setYearMonth(lastPriceTableRoute);
syncOfficeAggregationCaseMapper.insertUltimatePriceTable(ultimateOfficeBasePrice);
});
}

View File

@ -70,9 +70,9 @@ spring:
password: Lcdatacenter_888
calc:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_calc
username: sa
password: Lcdatacenter_888
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=CALC
username: purple
password: liancheng
spider:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST

View File

@ -60,7 +60,7 @@ spring:
password: lc1234
compute:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute_test
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute
username: sa
password: Lcdatacenter_888
clean:
@ -77,74 +77,4 @@ spring:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
username: purple
password: liancheng
# druid:
# statViewServlet:
# enabled: true
# # 设置白名单,不填则允许所有访问
# allow:
# url-pattern: /druid/*
# # 控制台管理用户名和密码
# login-username:
# login-password:
# dynamic:
# druid:
# # 初始连接数
# initialSize: 5
# # 最小连接池数量
# minIdle: 10
# # 最大连接池数量
# maxActive: 20
# # 配置获取连接等待超时的时间
# maxWait: 60000
# # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
# timeBetweenEvictionRunsMillis: 60000
# # 配置一个连接在池中最小生存的时间,单位是毫秒
# minEvictableIdleTimeMillis: 300000
# # 配置一个连接在池中最大生存的时间,单位是毫秒
# maxEvictableIdleTimeMillis: 900000
# # 配置检测连接是否有效
# validationQuery: SELECT 1
# testWhileIdle: true
# testOnBorrow: false
# testOnReturn: false
## webStatFilter:
## enabled: true
## filters: stat,wall
## wall:
## multiStatementAllow: true
# stat:
# log-slow-sql: true
# slow-sql-millis: 1000
# merge-sql: true
# primary: master
# datasource:
# # 主库数据源
# master:
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: LOLm2dI2UQF#RxOf
# # 从库数据源
## slave:
## # 从数据源开关/默认关闭
## enabled: false
## url:
## username:
## password:
# teemlink:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
# username: sa
# password: Lcdatacenter_888
# compute:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute
# username: sa
# password: Lcdatacenter_888
# clean:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean
# username: sa
# password: Lcdatacenter_888
password: liancheng

View File

@ -154,54 +154,102 @@
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
</update>
<resultMap id="AggregationCaseResultMapping" type="com.ruoyi.project.data.cases.domain.OfficeAggregationCase">
<result property="url" column="url"/>
<result property="title" column="title"/>
<result property="floorAreaRatio" column="容积率"/>
<result property="caseTotalPrice" column="总价售"/>
<result property="caseUnitPrice" column="均价售"/>
<result property="name" column="楼盘名称"/>
<result property="name_m" column="楼盘名称_M"/>
<result property="caseFloor" column="楼层"/>
<result property="area" column="面积"/>
<result property="managementFee" column="物业费"/>
<result property="seatCount" column="工位数"/>
<result property="address" column="地址"/>
<result property="metro" column="地铁"/>
<result property="publishDate" column="发布时间" jdbcType="DATE"/>
<result property="sourceNo" column="房源编号"/>
<result property="lng" column="百度lng"/>
<result property="lat" column="百度lat"/>
<result property="county" column="区域"/>
<result property="catalog" column="分类"/>
<result property="source" column="来源"/>
<result property="level" column="等级"/>
<result property="homePageUrl" column="楼盘网址"/>
<result property="decoration" column="装修"/>
<result property="type" column="类型"/>
<result property="block" column="板块"/>
<result property="agency" column="挂牌中介"/>
<result property="rentOfMonthly" column="月租金租"/>
<result property="rentOfStandard" column="标准租金租"/>
<result property="updateDate" column="更新时间" jdbcType="DATE"/>
<result property="score" column="得房率"/>
<result property="totalPrice" column="总价"/>
<result property="unitPrice" column="单价"/>
<result property="buildingId" column="BuildingID_P"/>
<result property="communityId" column="ProjectID_P"/>
<result property="totalFloor" column="TotalFloorSum"/>
<result property="floorCoefficient" column="FloorCoff"/>
<result property="decorationCoefficient" column="DecorationCoff"/>
<result property="priceAmend" column="PriceAmend"/>
<result property="mainPrice_1" column="MainPrice_1"/>
<result property="mainPriceRent_1" column="MainPriceRent_1"/>
<result property="listedPrice_1" column="ListedPrice_1"/>
<result property="listedPriceRent_1" column="ListedPriceRent_1"/>
<result property="listedPrice" column="ListedPrice"/>
<result property="listedPriceRent" column="ListedPriceRent"/>
<result property="vopp" column="VOPP"/>
<result property="voppt" column="VOPPT"/>
</resultMap>
<!-- 汇总案例 -->
<select id="getOfficeAggregationCases" resultType="com.ruoyi.project.data.cases.domain.OfficeAggregationCase">
SELECT url as url
,title as title
,容积率 as floorAreaRatio
,总价售 as caseTotalPrice
,均价售 as caseUnitPrice
,楼盘名称 as name
,楼盘名称_M as name_m
,楼层 as caseFloor
,面积 as area
,物业费 as managementFee
,工位数 as seatCount
,地址 as address
,地铁 as metro
,发布时间 as publishDate
,房源编号 as sourceNo
,百度lng as lng
,百度lat as lat
,区域 as county
,分类 as catalog
,来源 as source
,等级 as level
,楼盘网址 as homePageUrl
,装修 as decoration
,类型 as type
,板块 as block
,挂牌中介 as agency
,月租金租 as rentOfMonthly
,标准租金租 as rentOfStandard
,更新时间 as updateDate
,得房率 as score
,总价 as totalPrice
,单价 as unitPrice
,BuildingID_P as buildingId
,ProjectID_P as communityId
,TotalFloorSum as totalFloor
,FloorCoff as floorCoefficient
,DecorationCoff as decorationCoefficient
,PriceAmend as priceAmend
,MainPrice_1 as mainPrice_1
,MainPriceRent_1 as mainPriceRent_1
,ListedPrice_1 as listedPrice_1
,ListedPriceRent_1 as listedPriceRent_1
,ListedPrice as listedPrice
,ListedPriceRent as listedPriceRent
,VOPP as vopp
,VOPPT as voppt
<select id="getOfficeAggregationCases" resultMap="AggregationCaseResultMapping">
SELECT url
,title
,容积率
,总价售
,均价售
,楼盘名称
,楼盘名称_M
,楼层
,面积
,物业费
,工位数
,地址
,地铁
,发布时间
,房源编号
,百度lng
,百度lat
,区域
,分类
,来源
,等级
,楼盘网址
,装修
,类型
,板块
,挂牌中介
,月租金租
,标准租金租
,更新时间
,得房率
,总价
,单价
,BuildingID_P
,ProjectID_P
,TotalFloorSum
,FloorCoff
,DecorationCoff
,PriceAmend
,MainPrice_1
,MainPriceRent_1
,ListedPrice_1
,ListedPriceRent_1
,ListedPrice
,ListedPriceRent
,VOPP
,VOPPT
FROM dbo.DW_OFFICECASE_COMM_${yearMonth}
</select>
</mapper>

View File

@ -162,21 +162,28 @@
</insert>
<!--备份表-->
<update id="dumpPriceTable">
<bind name="backUpTableName" value="'dbo.ODS_OFFICE_BUILDING_PRICE_INFO_' + yearMonth+'_'+operateDate+'_bak'"/>
<bind name="targetTableName" value="'dbo.ODS_OFFICE_BUILDING_PRICE_INFO_' + yearMonth"/>
IF OBJECT_ID(#{backUpTableName}, 'U') IS NOT NULL
drop table ${backUpTableName}
select * into ${backUpTableName} from ${targetTableName}
</update>
<update id="clearPriceTable">
<bind name="targetTableName" value="'dbo.ODS_OFFICE_BUILDING_PRICE_INFO_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
select * into ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth}_${operateDate}_bak from ${targetTableName}
truncate table ${targetTableName}
</update>
<!--创建价格表-->
<update id="createPriceTable">
<update id="createUltimatePriceTable">
<bind name="targetTableName" value="'dbo.ODS_OFFICE_BUILDING_PRICE_INFO_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
create table ${targetTableName}(
id bigint identity not null ,
BuildingID bigint not null,
BuildingID bigint null,
UnifiedID bigint null,
ProjectID bigint not null,
ProjectID bigint null,
BuildingID_P nvarchar(20) not null,
ProjectID_P bigint null,
MainPrice decimal(38, 6) null,
@ -243,6 +250,9 @@
, UpperFloorSum
, OfficeClass
, Grade
, BuildingID
, ProjectID
, UnifiedID
) values(
#{buildingId},
#{communityId},
@ -273,7 +283,10 @@
#{totalFloorSum},
#{upperFloorSum},
#{officeClass},
#{officeLevel}
#{officeLevel},
#{deprecatedBuildingId},
#{deprecatedCommunityId},
#{unifiedId}
)
</update>
</mapper>

View File

@ -16,7 +16,7 @@
<result property="mainPriceRentPst" column="MainPriceRentPst"/>
<result property="mainPriceType" column="MainPriceType"/>
<result property="mainPriceRentType" column="MainPriceRentType"/>
<result property="updateDate" column="ModifyDate"/>
<result property="updateDate" column="ModifyDate" jdbcType="DATE"/>
<result property="status" column="Status"/>
<result property="standardBuilding" column="BuildingStd"/>
<result property="adjustPriceComment" column="AdjEvd"/>
@ -38,10 +38,16 @@
<result property="officeLevel" column="Grade"/>
<result property="mainPrice_1" column="mainPrice_1"/>
<result property="mainPriceRent_1" column="mainPriceRent_1"/>
<result property="deprecatedBuildingId" column="BuildingID"/>
<result property="deprecatedCommunityId" column="ProjectID"/>
<result property="unifiedId" column="UnifiedID"/>
</resultMap>
<sql id="getById">
SELECT a.ID
,a.BuildingID
,a.ProjectID
,a.UnifiedID
,a.BuildingID_P
,a.ProjectID_P
,a.MainPrice
@ -336,38 +342,42 @@
<update id="clearPriceTable">
truncate table ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth}
</update>
<select id="getUltimateOfficeBasePrices" resultType="com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice">
SELECT BuildingID_P as buildingId
,ProjectID_P as communityId
,MainPrice as mainPrice
,MainPriceRent as mainPriceRent
,MainPricePst as mainPricePst
,MainPriceRentPst as mainPriceRentPst
,MainPriceType as mainPriceType
,MainPriceRentType as mainPriceRentType
,ModifyDate as updateDate
,Status as status
,BuildingStd as standardBuilding
,AdjEvd as adjustPriceComment
,MainPrice_1 as mainPrice_1
,MainPriceRent_1 as mainPriceRent_1
,AreaCoff as areaCoefficient
,YearCoff as yearCoefficient
,BuildingCoff as buildingCoefficient
,ProjectName as communityName
,ProjectAddr as communityAddress
,BuildingAddr as buildingAddress
,County as countyName
,Loop as loopName
,Block as blockName
,Street as streetName
,Year as year
,AvgArea as avgArea
,TotalFloorSum as totalFloorSum
,UpperFloorSum as upperFloorSum
,OfficeClass as officeClass
,Grade as officeLevel,
${yearMonth} as yearMonth
<select id="getUltimateOfficeBasePrices" resultMap="OfficeBasePriceUltimateResult">
SELECT id
, BuildingID
, ProjectID
, UnifiedID
,BuildingID_P
,ProjectID_P
,MainPrice
,MainPriceRent
,MainPricePst
,MainPriceRentPst
,MainPriceType
,MainPriceRentType
,ModifyDate
,Status
,BuildingStd
,AdjEvd
,AreaCoff
,YearCoff
,BuildingCoff
,ProjectName
,ProjectAddr
,BuildingAddr
,County
,Loop
,Block
,Street
,Year
,AvgArea
,TotalFloorSum
,UpperFloorSum
,OfficeClass
,Grade
,MainPrice_1
,MainPriceRent_1
,${yearMonth} as yearMonth
FROM dbo.ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth}
</select>
</mapper>

View File

@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RuoYiApplication.class)
@ActiveProfiles("uat")
@ActiveProfiles("dev")
public class OfficeBasePriceTests {
@Autowired