feat(每月作价):迁移住宅租金计算
1. 下载链家租赁挂牌案例
This commit is contained in:
parent
5e11233226
commit
a3db8d8d01
@ -0,0 +1,124 @@
|
||||
package com.ruoyi.project.data.cases.domain;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 租赁数据
|
||||
*/
|
||||
public class OriginalResidenceRentOpeningCase extends OriginalResidenceSaleOpeningCase {
|
||||
|
||||
/**
|
||||
* 外部案例编号
|
||||
*/
|
||||
private String caseNo;
|
||||
/**
|
||||
* 总面积
|
||||
*/
|
||||
private BigDecimal caseTotalArea;
|
||||
/**
|
||||
* 出租类型
|
||||
*/
|
||||
private String caseRentType;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String caseStatus;
|
||||
/**
|
||||
* 板块
|
||||
*/
|
||||
private String caseBlock;
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String caseCounty;
|
||||
/**
|
||||
* 环线
|
||||
*/
|
||||
private String caseLoop;
|
||||
/**
|
||||
* 厅数量
|
||||
*/
|
||||
private Integer caseHallNum;
|
||||
/**
|
||||
* 室数量
|
||||
*/
|
||||
private Integer caseRoomNum;
|
||||
|
||||
public String getCaseNo() {
|
||||
return caseNo;
|
||||
}
|
||||
|
||||
public void setCaseNo(String caseNo) {
|
||||
this.caseNo = caseNo;
|
||||
}
|
||||
|
||||
public BigDecimal getCaseTotalArea() {
|
||||
return caseTotalArea;
|
||||
}
|
||||
|
||||
public void setCaseTotalArea(BigDecimal caseTotalArea) {
|
||||
this.caseTotalArea = caseTotalArea;
|
||||
}
|
||||
|
||||
public String getCaseRentType() {
|
||||
return caseRentType;
|
||||
}
|
||||
|
||||
public void setCaseRentType(String caseRentType) {
|
||||
this.caseRentType = caseRentType;
|
||||
}
|
||||
|
||||
public String getCaseStatus() {
|
||||
return caseStatus;
|
||||
}
|
||||
|
||||
public void setCaseStatus(String caseStatus) {
|
||||
this.caseStatus = caseStatus;
|
||||
}
|
||||
|
||||
public String getCaseBlock() {
|
||||
return caseBlock;
|
||||
}
|
||||
|
||||
public void setCaseBlock(String caseBlock) {
|
||||
this.caseBlock = caseBlock;
|
||||
}
|
||||
|
||||
public String getCaseCounty() {
|
||||
return caseCounty;
|
||||
}
|
||||
|
||||
public void setCaseCounty(String caseCounty) {
|
||||
this.caseCounty = caseCounty;
|
||||
}
|
||||
|
||||
public String getCaseLoop() {
|
||||
return caseLoop;
|
||||
}
|
||||
|
||||
public void setCaseLoop(String caseLoop) {
|
||||
this.caseLoop = caseLoop;
|
||||
}
|
||||
|
||||
public Integer getCaseHallNum() {
|
||||
return caseHallNum;
|
||||
}
|
||||
|
||||
public void setCaseHallNum(Integer caseHallNum) {
|
||||
this.caseHallNum = caseHallNum;
|
||||
}
|
||||
|
||||
public Integer getCaseRoomNum() {
|
||||
return caseRoomNum;
|
||||
}
|
||||
|
||||
public void setCaseRoomNum(Integer caseRoomNum) {
|
||||
this.caseRoomNum = caseRoomNum;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.project.data.cases.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@DS("compute")
|
||||
public interface OriginalResidenceRentClosingCaseMapper {
|
||||
|
||||
/**
|
||||
* 创建表
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createCleanTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 案例汇总表(挂牌、成交)
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
|
||||
/**
|
||||
* 作价表
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createComputePriceTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 人工修正价格表
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createArtificialPriceTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 分页总数
|
||||
*
|
||||
* @param originalResidenceSaleOpeningCase
|
||||
* @return
|
||||
*/
|
||||
Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
|
||||
|
||||
/**
|
||||
* @param queryModel
|
||||
* @return
|
||||
*/
|
||||
List<OriginalResidenceSaleOpeningCase> pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel);
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.project.data.cases.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@DS("compute")
|
||||
public interface OriginalResidenceRentOpeningCaseMapper {
|
||||
|
||||
/**
|
||||
* 创建表
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createCleanTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 案例汇总表(挂牌、成交)
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
|
||||
/**
|
||||
* 作价表
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createComputePriceTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 人工修正价格表
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createArtificialPriceTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 分页总数
|
||||
*
|
||||
* @param originalResidenceSaleOpeningCase
|
||||
* @return
|
||||
*/
|
||||
Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
|
||||
|
||||
/**
|
||||
* @param queryModel
|
||||
* @return
|
||||
*/
|
||||
List<OriginalResidenceSaleOpeningCase> pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.project.data.cases.mapper.sync;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@DS("oldProd")
|
||||
public interface DownloadOriginalResidenceRentOpeningCaseMapper {
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
List<OriginalResidenceRentOpeningCase> download();
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.project.data.cases.mapper.sync;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@DS("spider")
|
||||
public interface DownloadOriginalResidenceRentPlatformCaseMapper {
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
List<OriginalResidenceRentOpeningCase> download();
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.project.data.cases.mapper.sync;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@DS("calc")
|
||||
public interface SyncOriginalResidenceRentOpeningCaseMapper {
|
||||
|
||||
/**
|
||||
* 创建挂牌案例表
|
||||
* @param yearMonth
|
||||
*/
|
||||
int createTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param originalResidenceRentOpeningCase
|
||||
* @return
|
||||
*/
|
||||
int insert(OriginalResidenceRentOpeningCase originalResidenceRentOpeningCase);
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.ruoyi.project.data.cases.service;
|
||||
|
||||
public interface IOriginalResidenceRentClosingCaseService {
|
||||
void pullData();
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.ruoyi.project.data.cases.service;
|
||||
|
||||
public interface IOriginalResidenceRentOpeningCaseService {
|
||||
void pullData();
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package com.ruoyi.project.data.cases.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.common.utils.LoadUtil;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleClosingCaseMapper;
|
||||
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentClosingCaseService;
|
||||
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DS("compute")
|
||||
public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalResidenceRentClosingCaseService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceRentClosingCaseServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private OriginalResidenceSaleClosingCaseMapper originalResidenceSaleClosingCaseMapper;
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleClosingCaseMapper downloadOriginalResidenceSaleClosingCaseMapper;
|
||||
@Autowired
|
||||
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Scheduled(cron = "0 0 5 9 * ?")
|
||||
@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)));
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
|
||||
calendar.get(Calendar.MONTH) + 1));
|
||||
|
||||
prepare(computeTableRoute);
|
||||
List<OriginalResidenceSaleClosingCase> list =
|
||||
downloadOriginalResidenceSaleClosingCaseMapper.download(targetTableRoute);
|
||||
list.parallelStream().forEach(originalResidenceSaleClosingCase -> {
|
||||
originalResidenceSaleClosingCase.setCaseId(originalResidenceSaleClosingCase.generateCaseId());
|
||||
originalResidenceSaleClosingCase.setCleanPropertyType(originalResidenceSaleClosingCase.refinePropertyType());
|
||||
// originalResidenceSaleClosingCase.setCleanCurrentFloor(originalResidenceSaleClosingCase
|
||||
// .refineCurrentFloor());
|
||||
// originalResidenceSaleClosingCase.setCleanBuildingAddress(originalResidenceSaleClosingCase
|
||||
// .refineBuildingAddress());
|
||||
});
|
||||
running(computeTableRoute, list);
|
||||
after(computeTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备工作 创建表
|
||||
*
|
||||
* @param computeTableRoute
|
||||
*/
|
||||
public void prepare(Integer computeTableRoute) {
|
||||
originalResidenceSaleClosingCaseMapper.createTable(computeTableRoute);
|
||||
originalResidenceSaleClosingCaseMapper.createCleanTable(computeTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量入库
|
||||
*
|
||||
* @param computeTableRoute
|
||||
* @param list
|
||||
*/
|
||||
public void running(Integer computeTableRoute, List<OriginalResidenceSaleClosingCase> list) {
|
||||
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
|
||||
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
|
||||
".original_residence_sale_closing_case_" + computeTableRoute + "(case_id,case_county_name," +
|
||||
"case_block_name,case_loopline_name,case_community_name,case_address,case_area," +
|
||||
"case_unit_price,case_total_price,case_house_type,case_signing_date,case_register_date," +
|
||||
"case_agency_name,case_agency_type,case_seller_type,case_buyer_type,case_birthday," +
|
||||
"case_deal_type,clean_property_type,create_time) " +
|
||||
"values (:caseId,:caseCountyName,:caseBlockName,:caseLoopName,:caseCommunityName," +
|
||||
":caseAddress,:caseArea,:caseUnitPrice,:caseTotalPrice,:caseHouseType,:caseSigningDate," +
|
||||
":caseRegisterDate,:agencyName,:agencyType,:sellerType,:buyerType,:birthday," +
|
||||
":cleanCaseType,:cleanPropertyType,GETDATE());",
|
||||
batchParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配数据
|
||||
*
|
||||
* @param yearMonth
|
||||
*/
|
||||
public void after(Integer yearMonth) {
|
||||
// 清洗挂牌案例
|
||||
String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_closing_case.sql");
|
||||
String sql = rawSql.replace("#yearMonth#", yearMonth.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package com.ruoyi.project.data.cases.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.common.utils.LoadUtil;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalResidenceRentOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceRentOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceRentOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentOpeningCaseService;
|
||||
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DS("compute")
|
||||
public class OriginalResidenceRentOpeningCaseServiceImpl implements IOriginalResidenceRentOpeningCaseService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceRentOpeningCaseServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private OriginalResidenceRentOpeningCaseMapper originalResidenceRentOpeningCaseMapper;
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceRentOpeningCaseMapper downloadOriginalResidenceRentOpeningCaseMapper;
|
||||
@Autowired
|
||||
private SyncOriginalResidenceRentOpeningCaseMapper syncOriginalResidenceRentOpeningCaseMapper;
|
||||
@Autowired
|
||||
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
* 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 valuePoint = calendar.getTime();
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
|
||||
calendar.get(Calendar.MONTH) + 1));
|
||||
|
||||
prepare(computeTableRoute, syncTableRoute);
|
||||
List<OriginalResidenceRentOpeningCase> list = downloadOriginalResidenceRentOpeningCaseMapper.download();
|
||||
list.parallelStream().forEach(originalResidenceOpeningCase -> {
|
||||
// originalResidenceOpeningCase.clear();
|
||||
originalResidenceOpeningCase.setYearMonth(syncTableRoute);
|
||||
syncOriginalResidenceRentOpeningCaseMapper.insert(originalResidenceOpeningCase);
|
||||
});
|
||||
|
||||
// 两种数据,分别插入不同的表当中
|
||||
|
||||
running(computeTableRoute, list);
|
||||
after(computeTableRoute, lastYearMonth, valuePoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备工作 创建表
|
||||
*
|
||||
* @param computeTableRoute
|
||||
* @param syncTableRoute
|
||||
*/
|
||||
public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
|
||||
originalResidenceRentOpeningCaseMapper.createTable(computeTableRoute);
|
||||
originalResidenceRentOpeningCaseMapper.createCleanTable(computeTableRoute);
|
||||
originalResidenceRentOpeningCaseMapper.createAssembleTable(computeTableRoute);
|
||||
originalResidenceRentOpeningCaseMapper.createComputePriceTable(computeTableRoute);
|
||||
originalResidenceRentOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
|
||||
|
||||
syncOriginalResidenceRentOpeningCaseMapper.createTable(syncTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量入库
|
||||
*
|
||||
* @param computeTableRoute
|
||||
* @param list
|
||||
*/
|
||||
public void running(Integer computeTableRoute, List<OriginalResidenceRentOpeningCase> list) {
|
||||
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
|
||||
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
|
||||
".original_residence_rent_opening_case_" + computeTableRoute + "(case_id,case_lianjia_id," +
|
||||
"case_lianjia_community_id,case_title,case_apartment_layout,case_area,case_total_area," +
|
||||
"case_rent_type,case_status,case_hall_num,case_room_num,case_toward,case_storey," +
|
||||
"case_decoration,case_address,case_price,case_community_name,case_visited_num," +
|
||||
"case_visited_num_15,case_visited_num_30," +
|
||||
"case_first_visited_date,case_url,case_get_date,case_provider,create_time) values " +
|
||||
"(:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," +
|
||||
":caseApartmentLayout,:caseArea,:caseTotalArea,:caseRentType,:caseStatus,:caseHallNum," +
|
||||
":caseRoomNum,:caseToward,:caseStorey,:caseDecoration,:caseAddress,:casePrice,:caseCommunityName," +
|
||||
":caseVisitedNum,:caseVisitedNum15,:caseVisitedNum30,:caseFirstVisitTime,:caseUrl," +
|
||||
":caseGetDate,:caseProvider,GETDATE());",
|
||||
batchParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配数据
|
||||
* 计算基价
|
||||
*
|
||||
* @param yearMonth
|
||||
* @param lastYearMonth
|
||||
* @param valuePoint
|
||||
*/
|
||||
public void after(Integer yearMonth, Integer lastYearMonth, Date valuePoint) {
|
||||
// 清洗挂牌案例
|
||||
String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_opening_case.sql");
|
||||
String sql = rawSql.replace("#yearMonth#", yearMonth.toString())
|
||||
.replace("#lastYearMonth#", lastYearMonth.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
|
||||
// 作价
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
rawSql = LoadUtil.loadContent("sql-template/compute_residence_sale_base_price.sql");
|
||||
sql = rawSql.replace("#yearMonth#", yearMonth.toString())
|
||||
.replace("#lastYearMonth#", lastYearMonth.toString())
|
||||
.replace("#valuePoint#", simpleDateFormat.format(valuePoint));
|
||||
jdbcTemplate.update(sql);
|
||||
|
||||
logger.debug("#作价完成#");
|
||||
}
|
||||
}
|
@ -73,6 +73,11 @@ spring:
|
||||
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
|
||||
username: purple
|
||||
password: liancheng
|
||||
|
||||
# druid:
|
||||
# statViewServlet:
|
||||
|
@ -0,0 +1,58 @@
|
||||
<?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.DownloadOriginalResidenceRentOpeningCaseMapper">
|
||||
<resultMap id="resultMapping" type="com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase">
|
||||
<result property="caseLianJiaId" column="llid"/>
|
||||
<result property="caseLianJiaCommunityId" column="lcid"/>
|
||||
<result property="cleanCommunityId" column="airaid" />
|
||||
<result property="caseTitle" column="name"/>
|
||||
<result property="caseRentType" column="type"/>
|
||||
<result property="caseApartmentLayout" column="roomtype"/>
|
||||
<result property="caseArea" column="area" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseTotalArea" column="totalArea" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseToward" column="towards"/>
|
||||
<result property="caseStorey" column="storey"/>
|
||||
<result property="caseVisitedNum" column="visited_num"/>
|
||||
<result property="caseFirstVisitTime" column="first_visit_time" javaType="java.sql.Date"/>
|
||||
<result property="caseVisitedNum15" column="visited_num_15"/>
|
||||
<result property="caseVisitedNum30" column="visited_num_30"/>
|
||||
<result property="caseDecoration" column="decoration"/>
|
||||
<result property="caseAddress" column="address"/>
|
||||
<result property="caseStatus" column="statustxt"/>
|
||||
<result property="casePrice" column="price" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseUrl" column="url"/>
|
||||
<result property="caseCommunityUrl" column="curl"/>
|
||||
<result property="caseGetDate" column="created" javaType="java.sql.Date"/>
|
||||
<result property="caseProvider" column="caseProvider"/>
|
||||
</resultMap>
|
||||
<select id="download" resultMap="resultMapping">
|
||||
SELECT llid
|
||||
,lcid
|
||||
,airaid
|
||||
,name
|
||||
,type
|
||||
,roomtype
|
||||
,area
|
||||
,totalarea
|
||||
,towards
|
||||
,storey
|
||||
,visited_num
|
||||
,first_visit_time
|
||||
,visited_num_15
|
||||
,visited_num_30
|
||||
,postDate
|
||||
,decoration
|
||||
,address
|
||||
,created
|
||||
,statustxt
|
||||
,price
|
||||
,url
|
||||
,curl
|
||||
,cname
|
||||
,created
|
||||
, '链家' as caseProvider
|
||||
FROM dbo.ZListing_Lianjia
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,45 @@
|
||||
<?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.DownloadOriginalResidenceRentPlatformCaseMapper">
|
||||
<resultMap id="resultMapping" type="com.ruoyi.project.data.cases.domain.OriginalResidenceRentOpeningCase">
|
||||
<result property="caseArea" column="面积" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseBlock" column="block" />
|
||||
<result property="caseAddress" column="地址"/>
|
||||
<result property="caseCommunityName" column="小区名"/>
|
||||
<result property="caseUrl" column="来源页"/>
|
||||
<result property="caseDecoration" column="装修"/>
|
||||
<result property="caseStorey" column="楼层"/>
|
||||
<result property="caseHallNum" column="厅数"/>
|
||||
<result property="caseNo" column="编号"/>
|
||||
<!-- <result property="caseRentType" column="type"/>-->
|
||||
<result property="casePrice" column="price" javaType="java.math.BigDecimal"/>
|
||||
<result property="caseCounty" column="区域" />
|
||||
<result property="caseRentType" column="出租方式"/>
|
||||
<result property="caseRoomNum" column="室数"/>
|
||||
<result property="caseProvider" column="来源"/>
|
||||
<result property="caseGetDate" column="savetime" javaType="java.sql.Date"/>
|
||||
|
||||
</resultMap>
|
||||
<select id="download" resultMap="resultMapping">
|
||||
select 面积
|
||||
,block
|
||||
,地址
|
||||
,小区名
|
||||
,来源页
|
||||
,装修
|
||||
,楼层
|
||||
,厅数
|
||||
,编号
|
||||
,type
|
||||
,price
|
||||
,区域
|
||||
,出租方式
|
||||
,室数
|
||||
,来源
|
||||
,savetime
|
||||
FROM dbo.挂牌房源
|
||||
where savetime <![CDATA[ > ]]> #{startDate} and savetime <![CDATA[ <= ]]> #{endDate}
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user