feature(住宅租赁作价):新增成交案例来源

1. 添加太平洋提供住宅租赁案例数据
2. 查询页面和导出添加主力面积字段
This commit is contained in:
purple 2020-07-30 15:55:12 +08:00
parent 61c4ee1df4
commit 5dda87a984
28 changed files with 710 additions and 62 deletions

View File

@ -79,6 +79,7 @@
<el-table-column label="租金主力面积系数" align="center" prop="mainCoefficientRent" />
<el-table-column label="AI租金(草稿)" align="center" prop="rentPriceDft" />
<el-table-column label="主力面积租金(草稿)" align="center" prop="mainRentPriceDft" />
<el-table-column label="主力面积(㎡)" align="center" prop="area" />
<el-table-column label="上月AI租金" align="center" prop="rentPrice_1" />
<el-table-column label="成交均价(上周期)" align="center" prop="priceDealMean_1" />
<el-table-column label="成交最大价(上周期)" align="center" prop="priceDealMax_1" />

View File

@ -0,0 +1,27 @@
package com.ruoyi.common.exception;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.StringUtils;
/**
* 作价数据未找到
*
* @author ruoyi
*/
public class ComputeDataNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* 所属模块
*/
private String module;
public ComputeDataNotFoundException(String module) {
this.module = module;
}
@Override
public String getMessage() {
return module + "未找到相关案例数据。";
}
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.framework.task;
import com.ruoyi.project.data.cases.service.IOriginalOfficeCaseService;
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentClosingCaseService;
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentOpeningCaseService;
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalNewHouseCaseServiceImpl;
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalResidenceSaleClosingCaseServiceImpl;
@ -25,6 +26,10 @@ public class RyTask {
private DownloadOriginalNewHouseCaseServiceImpl downloadOriginalNewHouseCaseService;
@Autowired
private IOriginalOfficeCaseService originalOfficeCaseService;
@Autowired
private IOriginalResidenceRentOpeningCaseService originalResidenceRentOpeningCaseService;
@Autowired
private IOriginalResidenceRentClosingCaseService originalResidenceRentClosingCaseService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
@ -73,4 +78,17 @@ public class RyTask {
originalOfficeCaseService.compute();
}
/**
* 住宅租赁挂牌案例下载
*/
public void downloadRentOpeningCase() {
originalResidenceRentOpeningCaseService.pullData();
}
/**
* 住宅租赁成交案例下载
*/
public void downloadRentClosingCase() {
originalResidenceRentClosingCaseService.pullData();
}
}

View File

@ -7,6 +7,7 @@ import java.util.Date;
/**
* 租赁成交案例
* @author lihe
*/
public class OriginalResidenceRentClosingCase {
private String caseId;

View File

@ -0,0 +1,184 @@
package com.ruoyi.project.data.cases.domain;
import org.springframework.util.DigestUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.UUID;
/**
* 新的租赁成交案例
*
* @author lihe
*/
public class OtherResidenceRentClosingCase {
/**
* id
*/
private String caseId;
/**
* 案例区域
*/
private String caseDistrict;
/**
* 案例小区名称
*/
private String caseCommunityName;
/**
* 案例地址
*/
private String caseAddress;
/**
* 面积
*/
private BigDecimal caseArea;
/**
* 成交日期
*/
private Date closingDate;
/**
* 总价
*/
private BigDecimal caseTotalPrice;
/**
* 朝向
*/
private String caseDecoration;
/**
* 总楼层
*/
private Integer caseTotalFloor;
/**
* 所在层
*/
private String caseCurrentFloor;
/**
* 朝向
*/
private String caseToward;
/**
* 楼层
*/
private String caseFloor;
/**
* 小区
*/
private String uvCommunityId;
/**
* 楼栋
*/
private String uvBuildingId;
public String getCaseId() {
return UUID.randomUUID().toString().replace("-","");
}
public void setCaseId(String caseId) {
this.caseId = caseId;
}
public String getCaseDistrict() {
return caseDistrict;
}
public void setCaseDistrict(String caseDistrict) {
this.caseDistrict = caseDistrict;
}
public String getCaseCommunityName() {
return caseCommunityName;
}
public void setCaseCommunityName(String caseCommunityName) {
this.caseCommunityName = caseCommunityName;
}
public String getCaseAddress() {
return caseAddress;
}
public void setCaseAddress(String caseAddress) {
this.caseAddress = caseAddress;
}
public BigDecimal getCaseArea() {
return caseArea;
}
public void setCaseArea(BigDecimal caseArea) {
this.caseArea = caseArea;
}
public Date getClosingDate() {
return closingDate;
}
public void setClosingDate(Date closingDate) {
this.closingDate = closingDate;
}
public BigDecimal getCaseTotalPrice() {
return caseTotalPrice;
}
public void setCaseTotalPrice(BigDecimal caseTotalPrice) {
this.caseTotalPrice = caseTotalPrice;
}
public String getCaseDecoration() {
return caseDecoration;
}
public void setCaseDecoration(String caseDecoration) {
this.caseDecoration = caseDecoration;
}
public Integer getCaseTotalFloor() {
return caseTotalFloor;
}
public void setCaseTotalFloor(Integer caseTotalFloor) {
this.caseTotalFloor = caseTotalFloor;
}
public String getCaseCurrentFloor() {
return caseCurrentFloor;
}
public void setCaseCurrentFloor(String caseCurrentFloor) {
this.caseCurrentFloor = caseCurrentFloor;
}
public String getCaseToward() {
return caseToward;
}
public void setCaseToward(String caseToward) {
this.caseToward = caseToward;
}
public String getCaseFloor() {
return caseFloor;
}
public void setCaseFloor(String caseFloor) {
this.caseFloor = caseFloor;
}
public String getUvCommunityId() {
return uvCommunityId;
}
public void setUvCommunityId(String uvCommunityId) {
this.uvCommunityId = uvCommunityId;
}
public String getUvBuildingId() {
return uvBuildingId;
}
public void setUvBuildingId(String uvBuildingId) {
this.uvBuildingId = uvBuildingId;
}
}

View File

@ -18,6 +18,14 @@ public interface OriginalResidenceRentClosingCaseMapper {
*/
int createRawTable(@Param("yearMonth") Integer yearMonth);
/**
* 创建其他住宅租赁成交案例
*
* @param tableRoute
* @return
*/
int createOtherRawTable(@Param("yearMonth") Integer tableRoute);
/**
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
*
@ -33,8 +41,10 @@ public interface OriginalResidenceRentClosingCaseMapper {
* @return
*/
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
/**
* 作价表
*
* @param yearMonth
* @return
*/
@ -42,6 +52,7 @@ public interface OriginalResidenceRentClosingCaseMapper {
/**
* 人工修正价格表
*
* @param yearMonth
* @return
*/

View File

@ -25,6 +25,8 @@ public interface OriginalResidenceSaleClosingCaseMapper {
*/
int createRawTable(@Param("yearMonth") Integer yearMonth);
/**
* 插入住宅销售成交案例
*
@ -54,4 +56,6 @@ public interface OriginalResidenceSaleClosingCaseMapper {
* @return
*/
List<OriginalResidenceSaleOpeningCase> pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel);
}

View File

@ -6,13 +6,20 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 住宅租赁成交案例下载
*
* @author lihe
*/
@DS("calc")
public interface DownloadOriginalResidenceRentClosingCaseMapper {
/**
* 租赁成交案例数据下载
*
* @param yearMonth
* @return
*/
List<OriginalResidenceRentClosingCase> download(@Param("yearMonth") Integer yearMonth);
}

View File

@ -0,0 +1,25 @@
package com.ruoyi.project.data.cases.mapper.sync;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentClosingCase;
import com.ruoyi.project.data.cases.domain.OtherResidenceRentClosingCase;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 其他住宅租赁案例下载
*
* @author lihe
*/
@DS("spider2")
public interface DownloadOtherResidenceRentClosingCaseMapper {
/**
* 租赁成交案例数据下载
*
* @param yearMonth
* @return
*/
List<OtherResidenceRentClosingCase> download(@Param("yearMonth") Integer yearMonth);
}

View File

@ -1,5 +1,13 @@
package com.ruoyi.project.data.cases.service;
/**
* 住宅租赁成交案例Service
*
* @author lihe
*/
public interface IOriginalResidenceRentClosingCaseService {
/**
* 数据下载
*/
void pullData();
}

View File

@ -65,7 +65,7 @@ public class DownloadOriginalResidenceSaleClosingCaseServiceImpl {
running(tableRoute, originalResidenceSaleClosingCases);
after(tableRoute);
// copy2UVData(tableRoute, remoteTableRoute);
copy2UVData(tableRoute, remoteTableRoute);
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.project.data.cases.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.exception.ComputeDataNotFoundException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.OriginalOfficeCase;
@ -76,6 +77,9 @@ public class OriginalOfficeCaseServiceImpl implements IOriginalOfficeCaseService
// 下载列表
List<OriginalOfficeCase> downloadList = downloadOriginalOfficeCaseMapper.download(startDate, endDate);
if (0 == downloadList.size()) {
throw new ComputeDataNotFoundException("办公作价");
}
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(downloadList.toArray());
namedParameterJdbcTemplate.batchUpdate("insert into dbo.ODS_OFFICECASELISTED_" + yearMonth.toString() + "_RAW" +
"(case_id,url, title,容积率,总价售,均价售, 楼盘名称, 楼盘名称_M, 楼层, 面积, 物业费, 工位数, 地址, 地铁, 发布时间, 房源编号, 百度lng, " +

View File

@ -1,10 +1,13 @@
package com.ruoyi.project.data.cases.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentClosingCase;
import com.ruoyi.project.data.cases.domain.OtherResidenceRentClosingCase;
import com.ruoyi.project.data.cases.mapper.OriginalResidenceRentClosingCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceRentClosingCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.DownloadOtherResidenceRentClosingCaseMapper;
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentClosingCaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -31,6 +34,8 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
@Autowired
private DownloadOriginalResidenceRentClosingCaseMapper downloadOriginalResidenceRentClosingCaseMapper;
@Autowired
private DownloadOtherResidenceRentClosingCaseMapper downloadOtherResidenceRentClosingCaseMapper;
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
private JdbcTemplate jdbcTemplate;
@ -38,26 +43,19 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
/**
*
*/
@Scheduled(cron = "0 0 15 29 * ?")
@Override
public void pullData() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
Integer targetTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)));
Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
// targetTableRoute = 202005;
// computeTableRoute = 202007;
Integer targetTableRoute = DateUtils.getLastYearMonth();
Integer lastYearMonth = DateUtils.getYearMonth();
Integer computeTableRoute = DateUtils.getNextYearMonth();
prepare(computeTableRoute);
List<OriginalResidenceRentClosingCase> list =
downloadOriginalResidenceRentClosingCaseMapper.download(targetTableRoute);
running(computeTableRoute, list);
List<OtherResidenceRentClosingCase> otherResidenceRentClosingCaseList =
downloadOtherResidenceRentClosingCaseMapper.download(targetTableRoute);
running(computeTableRoute, list, otherResidenceRentClosingCaseList);
after(computeTableRoute, lastYearMonth);
}
@ -68,6 +66,8 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
*/
public void prepare(Integer computeTableRoute) {
originalResidenceRentClosingCaseMapper.createRawTable(computeTableRoute);
// 新增住宅租赁成交案例
originalResidenceRentClosingCaseMapper.createOtherRawTable(computeTableRoute);
originalResidenceRentClosingCaseMapper.createCleanTable(computeTableRoute);
originalResidenceRentClosingCaseMapper.createAssembleTable(computeTableRoute);
originalResidenceRentClosingCaseMapper.createComputeTable(computeTableRoute);
@ -81,7 +81,8 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
* @param computeTableRoute
* @param list
*/
public void running(Integer computeTableRoute, List<OriginalResidenceRentClosingCase> list) {
public void running(Integer computeTableRoute, List<OriginalResidenceRentClosingCase> list,
List<OtherResidenceRentClosingCase> otherResidenceRentClosingCaseList) {
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
".ODS_HOUSINGCASEDEAL_RENT_" + computeTableRoute + "_RAW(case_id, case_contract_no, " +
@ -92,6 +93,18 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
":caseRentPrice,:caseTotalFloor,:caseArea,:caseToward,:caseApartmentLayout,:caseDecoration," +
":cleanCommunityId,:cleanBuildingId);",
batchParams);
batchParams = SqlParameterSourceUtils.createBatch(otherResidenceRentClosingCaseList.toArray());
updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
".TEMP_ODS_HOUSINGCASEDEAL_RENT_" + computeTableRoute + "_RAW(case_id,case_district," +
"case_community_name,case_address,case_area,case_closing_date,case_total_price," +
"case_decoration,case_total_floor,case_current_floor,case_toward,case_floor,uv_community_id," +
"uv_building_id) " +
"values (:caseId,:caseDistrict,:caseCommunityName,:caseAddress,:caseArea,:closingDate," +
":caseTotalPrice,:caseDecoration,:caseTotalFloor,:caseCurrentFloor,:caseToward,:caseFloor," +
":uvCommunityId,:uvBuildingId);",
batchParams);
}
/**
@ -104,6 +117,12 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
String rawSql = LoadUtil.loadContent("sql-template/clear_rent_closing_case.sql");
String sql = rawSql.replace("#yearMonth#", yearMonth.toString());
jdbcTemplate.update(sql);
// 其他住宅租赁成交案例
rawSql = LoadUtil.loadContent("sql-template/clear_other_rent_closing_case.sql");
sql = rawSql.replace("#yearMonth#", yearMonth.toString());
jdbcTemplate.update(sql);
// 计算
rawSql = LoadUtil.loadContent("sql-template/compute_rent_price.sql");
sql = rawSql.replace("#yearMonth#", yearMonth.toString())

View File

@ -1,6 +1,7 @@
package com.ruoyi.project.data.cases.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.OriginalResidencePlatformRentOpeningCase;
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase;
@ -43,22 +44,20 @@ public class OriginalResidenceRentOpeningCaseServiceImpl implements IOriginalRes
/**
* 29号拉取挂牌案例
*/
@Scheduled(cron = "0 0 5 29 * ?")
@Override
public void pullData() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
Integer syncTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)));
Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
Date startDate = calendar.getTime();
calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
Date endDate = calendar.getTime();
Integer computeTableRoute = DateUtils.getNextYearMonth();
Integer lastYearMonth = DateUtils.getYearMonth();
Integer syncTableRoute = DateUtils.getLastYearMonth();
prepare(computeTableRoute, syncTableRoute);
// 拉取案例
List<OriginalResidenceRentOpeningCase> list = downloadOriginalResidenceRentOpeningCaseMapper.download();

View File

@ -18,6 +18,8 @@ public interface ComputeResidenceRentPriceMapper {
/**
* 查询列表
* @param ComputeResidenceRentBasePrice
* @return
*/
List<ComputeResidenceRentBasePrice> selectPageList(ComputeResidenceRentBasePrice ComputeResidenceRentBasePrice);

View File

@ -78,3 +78,8 @@ spring:
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
username: purple
password: liancheng
spider2:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.246:1433;DatabaseName=LCSP
username: lc_spider
password: lc123456

View File

@ -84,3 +84,8 @@ spring:
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
username: purple
password: liancheng
spider2:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.246:1433;DatabaseName=LCSP
username: lc_spider
password: lc123456

View File

@ -78,3 +78,8 @@ spring:
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
username: purple
password: liancheng
spider2:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.246:1433;DatabaseName=LCSP
username: lc_spider
password: lc123456

View File

@ -65,6 +65,7 @@
<result property="bind_MixProject_Pst" column="bind_MixProject_Pst"/>
<result property="voppat" column="voppat"/>
<result property="voppa" column="voppa"/>
<result property="area" column="area" javaType="DECIMAL"/>
</resultMap>
<sql id="selectOfficeBasePriceUltimateVo">
@ -127,6 +128,7 @@
,Bind_MixProject_Pst
,VOPPAT
,VOPPA
,area
FROM dbo.DWA_PROJECTBASEPRICE_RENT_IMDT_${yearMonth}
</sql>
@ -143,10 +145,11 @@
<select id="selectPageList"
parameterType="com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice"
resultMap="MainMappingResult">
<![CDATA[ SELECT ID,ProjectID,ProjectName,ProjectAddr,County,Block,[Loop] as loopLine,IsIndxGen,IsPstCalc,StatusRun,PropertyType,ProjectType,ProjectTypeDtl,ProjectLevel,PropertyDevPeriod,BindClassID,MainCoff_Rent,RentPriceDft,MainRentPriceDft,RentPrice_1,PriceDealMean_1,PriceDealMax_1,SumDeal_1,PriceDeal_1_ToAI_Pst,PriceDealMean,PriceDealMax,SumDeal,PriceDeal_ToAI_Pst,PriceDeal_ToLst_Pst,PriceCaseOff,PriceCaseOff_ToLst_Pst,PriceListedMin,PriceLstMn_ToAI_Pst,PriceCase1_ToAI_Pst,PriceCase2_ToAI_Pst,PriceCase1_ToLst_Pst,PriceCase2_ToLst_Pst,PriceCase1,PriceCase1AdjPst,SumCase1,PriceCase2,PriceCase2AdjPst,SumCase2,VOPPBT,VOPPB,BindProjID,Bind_Proj_Pst,Bind_Block_Class,Bind_Block_Class_Pst,Bind_Block_Plevel,Bind_Block_Plevel_Pst,Bind_Block_PType,Bind_Block_Ptype_Pst,Bind_County_PType,Bind_County_Ptype_Pst,Bind_MixProject_PType,Bind_MixProject_Pst,VOPPAT,VOPPA ]]>
<![CDATA[
SELECT ID,ProjectID,ProjectName,ProjectAddr,County,Block,[Loop] as loopLine,IsIndxGen,IsPstCalc,StatusRun,PropertyType,ProjectType,ProjectTypeDtl,ProjectLevel,PropertyDevPeriod,BindClassID,MainCoff_Rent,RentPriceDft,MainRentPriceDft,RentPrice_1,PriceDealMean_1,PriceDealMax_1,SumDeal_1,PriceDeal_1_ToAI_Pst,PriceDealMean,PriceDealMax,SumDeal,PriceDeal_ToAI_Pst,PriceDeal_ToLst_Pst,PriceCaseOff,PriceCaseOff_ToLst_Pst,PriceListedMin,PriceLstMn_ToAI_Pst,PriceCase1_ToAI_Pst,PriceCase2_ToAI_Pst,PriceCase1_ToLst_Pst,PriceCase2_ToLst_Pst,PriceCase1,PriceCase1AdjPst,SumCase1,PriceCase2,PriceCase2AdjPst,SumCase2,VOPPBT,VOPPB,BindProjID,Bind_Proj_Pst,Bind_Block_Class,Bind_Block_Class_Pst,Bind_Block_Plevel,Bind_Block_Plevel_Pst,Bind_Block_PType,Bind_Block_Ptype_Pst,Bind_County_PType,Bind_County_Ptype_Pst,Bind_MixProject_PType,Bind_MixProject_Pst,VOPPAT,VOPPA,area ]]>
FROM dbo.DWA_PROJECTBASEPRICE_RENT_IMDT_${yearMonth}
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
</select>
</select>
<!-- -->
<select id="selectById" parameterType="String" resultMap="MainMappingResult">

View File

@ -42,10 +42,10 @@
物业费, 工位数, 地址, 地铁,
发布时间,房源编号, 百度lng, 百度lat, 区域, 分类, 来源, 等级, 楼盘网址, 装修,
类型, 板块, 挂牌中介, 月租金租, 标准租金租, 更新时间, 得房率,
case when 分类 = '售' then (case 总价售 when 'nan' then NULL ELSE 总价售 END)
when 分类 = '租' then (case 月租金租 when 'nan' then NULL ELSE 月租金租 END) end as 总价,
case when 分类 = '售' then (case 均价售 when 'nan' then NULL ELSE 均价售 END)
when 分类 = '租' then (case 标准租金租 when 'nan' then NULL ELSE 标准租金租 END) end as 单价
case when 分类 = '售' then (case when ISNUMERIC(总价售)=1 then 总价售 ELSE NULL END)
when 分类 = '租' then (case when ISNUMERIC(月租金租)=1 then 月租金租 ELSE NULL END) end as 总价,
case when 分类 = '售' then (case when ISNUMERIC(均价售)=1 then 均价售 ELSE NULL END)
when 分类 = '租' then (case when ISNUMERIC(标准租金租)=1 then 标准租金租 ELSE NULL END) end as 单价
from dbo.办公
where 更新时间 >= #{startDate,jdbcType=DATE} and 更新时间 <![CDATA[ < ]]> #{endDate,jdbcType=DATE}
</select>

View File

@ -4,18 +4,18 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceRentClosingCaseMapper">
<select id="download" resultType="com.ruoyi.project.data.cases.domain.OriginalResidenceRentClosingCase">
SELECT 合同编号 as caseContractNo
,小区名称 as caseCommunityName
,挂牌时间 as caseOpeningDate
,交时间 as caseClosingDate
,租金 as caseRentPrice
,建筑面积 as caseArea
,住宅楼总楼层 as caseTotalFloor
SELECT 案例ID as caseContractNo
,NULL as caseCommunityName
,NULL as caseOpeningDate
,交时间 as caseClosingDate
,"租金(元/月)" as caseRentPrice
,面积 as caseArea
,总楼层 as caseTotalFloor
,朝向 as caseToward
,户型 as caseApartmentLayout
,装修状况 as caseDecoration
,小区ID as caseCommunityId
,室厅 as caseApartmentLayout
,NULL as caseDecoration
,AIID as caseCommunityId
,楼栋ID as caseBuildingId
FROM dbo.ODS_HOUSINGCASEDEAL_RENT_${yearMonth}_RAW
FROM dbo.住宅租赁成交案例_链家_${yearMonth}
</select>
</mapper>

View File

@ -30,7 +30,7 @@
<result property="caseProvider" column="caseProvider"/>
</resultMap>
<select id="download" resultMap="resultMapping">
SELECT top 1000 llid
SELECT llid
,lcid
,airaid
,name

View File

@ -23,7 +23,7 @@
</resultMap>
<select id="download" resultMap="resultMapping">
select top 100 面积
select 面积
,block
,地址
,小区名

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.DownloadOtherResidenceRentClosingCaseMapper">
<resultMap id="DownloadMapping" type="com.ruoyi.project.data.cases.domain.OtherResidenceRentClosingCase">
<result property="caseDistrict" column="County"/>
<result property="caseCommunityName" column="ProjectName_SRC"/>
<result property="caseAddress" column="HouseholdsAddr_SRC" />
<result property="caseArea" column="Area" javaType="java.math.BigDecimal"/>
<result property="closingDate" column="PriceDateOut" javaType="java.sql.Date"/>
<result property="caseTotalPrice" column="PriceTotal" javaType="java.math.BigDecimal"/>
<result property="caseDecoration" column="Decoration" />
<result property="caseTotalFloor" column="UpperFloorSum" />
<result property="caseCurrentFloor" column="UpperFloorNum" />
<result property="caseToward" column="Towards" />
<result property="caseFloor" column="Storey" />
<result property="uvCommunityId" column="ProjectID" />
<result property="uvBuildingId" column="BuildingID" />
</resultMap>
<select id="download" resultMap="DownloadMapping">
SELECT County
,ProjectName_SRC
,HouseholdsAddr_SRC
,Area
,PriceDateOut
,PriceTotal
,Decoration
,UpperFloorSum
,UpperFloorNum
,Towards
,Storey
,ProjectID
,BuildingID
FROM dbo.TEMP_ODS_HOUSINGCASEDEAL_RENT_${yearMonth}_RAW
</select>
</mapper>

View File

@ -25,6 +25,27 @@
clean_building_id nvarchar (32) NULL
)
</update>
<update id="createOtherRawTable">
<bind name="targetTableName" value="'dbo.TEMP_ODS_HOUSINGCASEDEAL_RENT_' + yearMonth+'_RAW'"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
CREATE TABLE ${targetTableName}(
case_id varchar(32) NOT NULL primary key,
case_district nvarchar(64) NULL,
case_community_name nvarchar(1024) NULL,
case_address nvarchar(1024) NULL,
case_area decimal(18, 2) NULL,
case_closing_date date NULL,
case_total_price decimal(18, 2) NOT NULL,
case_decoration nvarchar(64) NULL,
case_total_floor int null,
case_current_floor nvarchar(32) NULL,
case_toward nvarchar(64) NULL,
case_floor nvarchar(32) NULL,
uv_community_id nvarchar(20) null,
uv_building_id nvarchar(20) null
)
</update>
<update id="createCleanTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASEDEAL_RENT_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL

View File

@ -0,0 +1,258 @@
delete from ODS_HOUSINGCASEDEAL_RENT_#yearMonth# where Origin='太平洋';
create table #HousingCaseListAdj
(
case_id varchar(32) not null
, HouseholdsID_SRC nvarchar(64) primary key
, ProjectID_SRC nvarchar(64) not null
, ProjectID nvarchar(64)
, BuildingID nvarchar(64)
, RentType tinyint
, Area decimal(18, 2)
, Towards nvarchar(64)
, UpperFloorSum nvarchar(32)
, UpperFloorNum nvarchar(32)
, Decoration nvarchar(64)
, PriceTotal decimal(18, 2) not null
, PriceUnit decimal(18, 2) not null
, PriceDateOut date
, CaseName nvarchar(512)
);
declare @HouseholdsID_SRC nvarchar(64)
, @CaseName nvarchar(512)
, @ProjectID nvarchar(64)
, @BuildingID nvarchar(64)
, @roomtype nvarchar(50)
, @UpperFloorSum nvarchar(32)
, @UpperFloorNum nvarchar(32)
, @area decimal(28, 2)
, @towards nvarchar(50)
, @decora nvarchar(64)
, @price decimal(28, 2)
, @dueDate date
, @case_id varchar(32)
, @RentType tinyint
, @priceunit decimal(28, 2);
declare Record2Insert cursor for
SELECT case_id
,case_id
,case_community_name
,case_closing_date
,case_total_price
,case_area
,case_total_floor
,case_current_floor
,case_toward
,case_decoration
,uv_community_id
,uv_building_id
FROM dbo.TEMP_ODS_HOUSINGCASEDEAL_RENT_#yearMonth#_RAW;
open Record2Insert;
fetch next from Record2Insert
into @case_id
, @HouseholdsID_SRC
, @CaseName
, @dueDate
, @price
, @area
, @UpperFloorSum
, @UpperFloorNum
, @towards
, @decora
, @ProjectID
, @BuildingID;
set nocount on; --
while @@fetch_status = 0
begin
begin
--
set @RentType = case
when @area < 30 then
3
else
2
end; --
--
set @area = case
when @area <> 0 then
@area
end;
--
set @priceunit = @price * 1.0 / isnull(@area, 1.0);
--
insert into #HousingCaseListAdj(case_id,HouseholdsID_SRC,ProjectID_SRC,ProjectID,BuildingID,RentType,Area,Towards,
UpperFloorSum,UpperFloorNum,Decoration,PriceTotal,PriceUnit,PriceDateOut,CaseName)
values
(@case_id, @HouseholdsID_SRC, '-1', @ProjectID, @BuildingID, @RentType, @area
, @towards, @UpperFloorSum, @UpperFloorNum, @decora, @price, @priceunit, @dueDate, @CaseName);
end;
fetch next from Record2Insert
into @case_id
, @HouseholdsID_SRC
, @CaseName
, @dueDate
, @price
, @area
, @UpperFloorSum
, @UpperFloorNum
, @towards
, @decora
, @ProjectID
, @BuildingID;
end;
close Record2Insert;
deallocate Record2Insert;
set nocount off;
create table #HousingCaseListSTD
(
case_id varchar(32)
, HouseholdsID_SRC nvarchar(64)
, ProjectID_SRC nvarchar(64)
, ProjectID nvarchar(64)
, BuildingID nvarchar(64)
, 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.case_id
, A.HouseholdsID_SRC
, A.ProjectID_SRC
, A.ProjectID
, null
, D.CoefficientA * A.Area + D.CoefficientB as AreaCoff
, E.Coefficient as TowardsCoff
, F.Coefficient as FloorCoff
, G.Coefficient as DecorationRng
, null as YearCoff
, null as BuildingCoff
, NULL as RoomTypeCoff
, A.PriceUnit
, (A.PriceUnit - isnull(G.Coefficient, 0)) * 1.0 / isnull(D.CoefficientA * A.Area + D.CoefficientB, 1)
/ isnull(E.Coefficient, 1) / isnull(F.Coefficient, 1) PriceScatterRent
, (A.PriceUnit - isnull(G.Coefficient, 0)) * 1.0 / isnull(D.CoefficientA * A.Area + D.CoefficientB, 1)
/ isnull(E.Coefficient, 1) / isnull(F.Coefficient, 1) + isnull(G.Coefficient, 0) PriceEntireRent
, A.PriceTotal * 1.0 / isnull(F.Coefficient, 1) / isnull(E.Coefficient, 1) as PriceShareRent0
, null as PriceShareRent
from #HousingCaseListAdj A
left join
(select projectid,ProjectLevel from obpm_LianCheng_Data.dbo.V_RESIDENCE_COMMUNITY) C
on A.ProjectID = C.projectid
left join
(
select ProjectLevel
, UpperKey
, LowerKey
, CoefficientA
, CoefficientB
from obpm_LianCheng_Data.dbo.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 SingleKey
, Coefficient
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '朝向(租金)'
and ProjectType = '公寓'
) E --
on A.Towards = E.SingleKey
left join
(
select UpperKey
, LowerKey
, Elevator
, Coefficient
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '楼层(租金)'
and ProjectType = '公寓'
) F --
on F.Elevator is null
and A.UpperFloorSum = F.UpperKey
and A.UpperFloorNum = F.LowerKey
left join
(
select SingleKey
, Coefficient
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '室内装修(租金)'
and ProjectType = '公寓'
) G --
on A.Decoration = G.SingleKey;
insert into ODS_HOUSINGCASEDEAL_RENT_#yearMonth#
select a.case_id
, A.HouseholdsID_SRC
, A.ProjectID_SRC
, A.ProjectID
, A.BuildingID
, A.RentType
, NULL
, NULL
, NULL
, A.Area
, A.Towards
, A.UpperFloorSum
, A.UpperFloorNum
, null Elevator
, A.Decoration
, null as 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
, null
, null
, null
, null
, 4 as Status
, null
, null
, null
, null
, null
, null
, null
, A.PriceTotal PriceTotalIn
, A.PriceTotal PriceTotalOut
, NULL
, A.PriceDateOut
, '太平洋'
, null
, null
, CaseName
from #HousingCaseListAdj A
left join #HousingCaseListSTD B
on A.HouseholdsID_SRC = B.HouseholdsID_SRC;
drop table #HousingCaseListAdj
, #HousingCaseListSTD;

View File

@ -82,7 +82,7 @@ public class GenerateTableTests {
@Test
public void generateBatchInsertSqL() {
Class targetClass = OriginalResidenceRentClosingCase.class;
Class targetClass = OtherResidenceRentClosingCase .class;
List<Field> fieldList = new ArrayList<>();
while (targetClass != null) {
@ -224,5 +224,9 @@ public class GenerateTableTests {
}
}
@Test
public void printUUID(){
System.out.println(UUID.randomUUID().toString().replace("-",""));
}
}

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 ResidenceRentBasePriceTests {
@Autowired