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; import java.util.Date;
/** /**
*
* @author purple * @author purple
* @date 2020-05-20 * @date 2020-05-20
*/ */
@ -22,6 +21,7 @@ public class UltimateOfficeBasePrice extends BaseEntity {
private Integer yearMonth; private Integer yearMonth;
@JSONField(serialize = false) @JSONField(serialize = false)
private Integer lastYearMonth; private Integer lastYearMonth;
@Excel(name = "楼栋ID-平台") @Excel(name = "楼栋ID-平台")
private String buildingId; private String buildingId;
@Excel(name = "小区ID-平台") @Excel(name = "小区ID-平台")
@ -74,19 +74,23 @@ public class UltimateOfficeBasePrice extends BaseEntity {
private BigDecimal yearCoefficient; private BigDecimal yearCoefficient;
@Excel(name = "基价楼栋系数") @Excel(name = "基价楼栋系数")
private BigDecimal buildingCoefficient; private BigDecimal buildingCoefficient;
// @Excel(name = "更新日期") // @Excel(name = "更新日期")
private Date updateDate; private Date updateDate;
// @Excel(name = "状态") // @Excel(name = "状态")
private Boolean status; private Boolean status;
@Excel(name = "是否标准楼栋") @Excel(name = "是否标准楼栋")
private Boolean standardBuilding; private Boolean standardBuilding;
// @Excel(name = "更改价格说明") // @Excel(name = "更改价格说明")
private String adjustPriceComment; private String adjustPriceComment;
/** /**
* 名称或者地址 * 名称或者地址
*/ */
private String nameOrAddress; private String nameOrAddress;
private String deprecatedBuildingId;
private String deprecatedCommunityId;
private String unifiedId;
public Integer getLastYearMonth() { public Integer getLastYearMonth() {
return lastYearMonth; return lastYearMonth;
} }
@ -374,4 +378,29 @@ public class UltimateOfficeBasePrice extends BaseEntity {
public void setNameOrAddress(String nameOrAddress) { public void setNameOrAddress(String nameOrAddress) {
this.nameOrAddress = 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("#today#", priceDate)
.replace("#lastMonth#", lastPriceDate); .replace("#lastMonth#", lastPriceDate);
jdbcTemplate.update(sql); 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); syncOfficeAggregationCaseMapper.createAggregationCaseTable(currentPriceTableRoute);
List<OfficeAggregationCase> list = originalOfficeCaseMapper.getOfficeAggregationCases(yearMonth); List<OfficeAggregationCase> list = originalOfficeCaseMapper.getOfficeAggregationCases(yearMonth);
list.parallelStream().forEach(officeAggregationCase -> { list.parallelStream().forEach(officeAggregationCase -> {
officeAggregationCase.setYearMonth(currentPriceTableRoute);
syncOfficeAggregationCaseMapper.insertAggregationCase(officeAggregationCase); syncOfficeAggregationCaseMapper.insertAggregationCase(officeAggregationCase);
}); });
@ -258,6 +266,7 @@ public class UltimateOfficeBasePriceServiceImpl implements IUltimateOfficeBasePr
List<UltimateOfficeBasePrice> ultimateOfficeBasePrices = List<UltimateOfficeBasePrice> ultimateOfficeBasePrices =
ultimateOfficeBasePriceMapper.getUltimateOfficeBasePrices(yearMonth); ultimateOfficeBasePriceMapper.getUltimateOfficeBasePrices(yearMonth);
ultimateOfficeBasePrices.parallelStream().forEach(ultimateOfficeBasePrice -> { ultimateOfficeBasePrices.parallelStream().forEach(ultimateOfficeBasePrice -> {
ultimateOfficeBasePrice.setYearMonth(currentPriceTableRoute);
syncOfficeAggregationCaseMapper.insertUltimatePriceTable(ultimateOfficeBasePrice); syncOfficeAggregationCaseMapper.insertUltimatePriceTable(ultimateOfficeBasePrice);
}); });
@ -272,6 +281,7 @@ public class UltimateOfficeBasePriceServiceImpl implements IUltimateOfficeBasePr
List<UltimateOfficeBasePrice> lastUltimateOfficeBasePrices = List<UltimateOfficeBasePrice> lastUltimateOfficeBasePrices =
ultimateOfficeBasePriceMapper.getUltimateOfficeBasePrices(lastPriceTableRoute); ultimateOfficeBasePriceMapper.getUltimateOfficeBasePrices(lastPriceTableRoute);
lastUltimateOfficeBasePrices.parallelStream().forEach(ultimateOfficeBasePrice -> { lastUltimateOfficeBasePrices.parallelStream().forEach(ultimateOfficeBasePrice -> {
ultimateOfficeBasePrice.setYearMonth(lastPriceTableRoute);
syncOfficeAggregationCaseMapper.insertUltimatePriceTable(ultimateOfficeBasePrice); syncOfficeAggregationCaseMapper.insertUltimatePriceTable(ultimateOfficeBasePrice);
}); });
} }

View File

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

View File

@ -60,7 +60,7 @@ spring:
password: lc1234 password: lc1234
compute: compute:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 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 username: sa
password: Lcdatacenter_888 password: Lcdatacenter_888
clean: clean:
@ -78,73 +78,3 @@ spring:
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
username: purple username: purple
password: liancheng 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

View File

@ -154,54 +154,102 @@
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName}; drop table ${targetTableName};
</update> </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 id="getOfficeAggregationCases" resultMap="AggregationCaseResultMapping">
SELECT url as url SELECT url
,title as title ,title
,容积率 as floorAreaRatio ,容积率
,总价售 as caseTotalPrice ,总价售
,均价售 as caseUnitPrice ,均价售
,楼盘名称 as name ,楼盘名称
,楼盘名称_M as name_m ,楼盘名称_M
,楼层 as caseFloor ,楼层
,面积 as area ,面积
,物业费 as managementFee ,物业费
,工位数 as seatCount ,工位数
,地址 as address ,地址
,地铁 as metro ,地铁
,发布时间 as publishDate ,发布时间
,房源编号 as sourceNo ,房源编号
,百度lng as lng ,百度lng
,百度lat as lat ,百度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 ,BuildingID_P
,ProjectID_P as communityId ,ProjectID_P
,TotalFloorSum as totalFloor ,TotalFloorSum
,FloorCoff as floorCoefficient ,FloorCoff
,DecorationCoff as decorationCoefficient ,DecorationCoff
,PriceAmend as priceAmend ,PriceAmend
,MainPrice_1 as mainPrice_1 ,MainPrice_1
,MainPriceRent_1 as mainPriceRent_1 ,MainPriceRent_1
,ListedPrice_1 as listedPrice_1 ,ListedPrice_1
,ListedPriceRent_1 as listedPriceRent_1 ,ListedPriceRent_1
,ListedPrice as listedPrice ,ListedPrice
,ListedPriceRent as listedPriceRent ,ListedPriceRent
,VOPP as vopp ,VOPP
,VOPPT as voppt ,VOPPT
FROM dbo.DW_OFFICECASE_COMM_${yearMonth} FROM dbo.DW_OFFICECASE_COMM_${yearMonth}
</select> </select>
</mapper> </mapper>

View File

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

View File

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

View File

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