feature (住宅销售作价): 实现定时住宅销售基价作价
1. 住宅销售成交案例 2. 住宅销售挂牌案例 3. 案例清洗 4. 作价
This commit is contained in:
@ -3,84 +3,102 @@ package com.ruoyi.common.utils;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
/**
|
||||
* 时间工具类
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
{
|
||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
public static String YYYY = "yyyy";
|
||||
|
||||
public static String YYYY_MM = "yyyy-MM";
|
||||
public static String YYYYMM = "yyyyMM";
|
||||
|
||||
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
|
||||
private static String[] parsePatterns = {
|
||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||
|
||||
/**
|
||||
* 获取当前Date型日期
|
||||
*
|
||||
*
|
||||
* @return Date() 当前日期
|
||||
*/
|
||||
public static Date getNowDate()
|
||||
{
|
||||
public static Date getNowDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期, 默认格式为yyyy-MM-dd
|
||||
*
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public static String getDate()
|
||||
{
|
||||
public static String getDate() {
|
||||
return dateTimeNow(YYYY_MM_DD);
|
||||
}
|
||||
|
||||
public static final String getTime()
|
||||
{
|
||||
|
||||
public static Integer getYearMonth() {
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return getYearMonth(calendar);
|
||||
}
|
||||
|
||||
public static Integer getLastYearMonth() {
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
return getYearMonth(calendar);
|
||||
}
|
||||
|
||||
public static Integer getNextYearMonth() {
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
return getYearMonth(calendar);
|
||||
}
|
||||
|
||||
private static Integer getYearMonth(Calendar calendar) {
|
||||
return new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
|
||||
}
|
||||
|
||||
public static final String getTime() {
|
||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||
}
|
||||
|
||||
public static final String dateTimeNow()
|
||||
{
|
||||
public static final String dateTimeNow() {
|
||||
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||
}
|
||||
|
||||
public static final String dateTimeNow(final String format)
|
||||
{
|
||||
public static final String dateTimeNow(final String format) {
|
||||
return parseDateToStr(format, new Date());
|
||||
}
|
||||
|
||||
public static final String dateTime(final Date date)
|
||||
{
|
||||
public static final String dateTime(final Date date) {
|
||||
return parseDateToStr(YYYY_MM_DD, date);
|
||||
}
|
||||
|
||||
public static final String parseDateToStr(final String format, final Date date)
|
||||
{
|
||||
public static final String parseDateToStr(final String format, final Date date) {
|
||||
return new SimpleDateFormat(format).format(date);
|
||||
}
|
||||
|
||||
public static final Date dateTime(final String format, final String ts)
|
||||
{
|
||||
try
|
||||
{
|
||||
public static final Date dateTime(final String format, final String ts) {
|
||||
try {
|
||||
return new SimpleDateFormat(format).parse(ts);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@ -88,8 +106,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
/**
|
||||
* 日期路径 即年/月/日 如2018/08/08
|
||||
*/
|
||||
public static final String datePath()
|
||||
{
|
||||
public static final String datePath() {
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||
}
|
||||
@ -97,36 +114,30 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
/**
|
||||
* 日期路径 即年/月/日 如20180808
|
||||
*/
|
||||
public static final String dateTime()
|
||||
{
|
||||
public static final String dateTime() {
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期型字符串转化为日期 格式
|
||||
*/
|
||||
public static Date parseDate(Object str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
public static Date parseDate(Object str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
try {
|
||||
return parseDate(str.toString(), parsePatterns);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
} catch (ParseException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取服务器启动时间
|
||||
*/
|
||||
public static Date getServerStartDate()
|
||||
{
|
||||
public static Date getServerStartDate() {
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
return new Date(time);
|
||||
}
|
||||
@ -134,8 +145,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
/**
|
||||
* 计算两个时间差
|
||||
*/
|
||||
public static String getDatePoor(Date endDate, Date nowDate)
|
||||
{
|
||||
public static String getDatePoor(Date endDate, Date nowDate) {
|
||||
long nd = 1000 * 24 * 60 * 60;
|
||||
long nh = 1000 * 60 * 60;
|
||||
long nm = 1000 * 60;
|
||||
|
@ -1,28 +1,63 @@
|
||||
package com.ruoyi.framework.task;
|
||||
|
||||
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentOpeningCaseService;
|
||||
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalResidenceSaleClosingCaseServiceImpl;
|
||||
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalResidenceSaleOpeningCaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 定时任务调度测试
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component("ryTask")
|
||||
public class RyTask
|
||||
{
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
|
||||
{
|
||||
public class RyTask {
|
||||
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleOpeningCaseServiceImpl downloadOriginalResidenceSaleOpeningCaseService;
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleClosingCaseServiceImpl downloadOriginalResidenceSaleClosingCaseService;
|
||||
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
|
||||
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
|
||||
}
|
||||
|
||||
public void ryParams(String params)
|
||||
{
|
||||
public void ryParams(String params) {
|
||||
System.out.println("执行有参方法:" + params);
|
||||
}
|
||||
|
||||
public void ryNoParams()
|
||||
{
|
||||
public void ryNoParams() {
|
||||
System.out.println("执行无参方法");
|
||||
}
|
||||
|
||||
/**
|
||||
* 住宅销售挂牌案例
|
||||
*/
|
||||
public void downloadResidenceOpeningCase() {
|
||||
downloadOriginalResidenceSaleOpeningCaseService.download();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载第一批一手房成交案例
|
||||
*/
|
||||
public void downloadFirstNewHouseCase() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载住宅销售二手房成交案例
|
||||
*/
|
||||
public void downloadResidenceClosingCase() {
|
||||
downloadOriginalResidenceSaleClosingCaseService.download();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载第二批一手房成交案例
|
||||
*/
|
||||
public void downloadSecondNewHouseCase() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ public class OriginalResidenceSaleClosingCase {
|
||||
shangye.add("商店");
|
||||
}
|
||||
|
||||
private Integer yearMonth;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
@ -264,14 +266,14 @@ public class OriginalResidenceSaleClosingCase {
|
||||
*/
|
||||
private BigDecimal refUnitPrice;
|
||||
|
||||
public String getCaseId() {
|
||||
return caseId;
|
||||
}
|
||||
|
||||
public void setCaseId(String caseId) {
|
||||
this.caseId = caseId;
|
||||
}
|
||||
|
||||
public String getCaseId() {
|
||||
return caseId;
|
||||
}
|
||||
|
||||
public String getCaseCommunityName() {
|
||||
return caseCommunityName;
|
||||
}
|
||||
@ -736,6 +738,14 @@ public class OriginalResidenceSaleClosingCase {
|
||||
this.cleanCurrentFloorDesc = cleanCurrentFloorDesc;
|
||||
}
|
||||
|
||||
public Integer getYearMonth() {
|
||||
return yearMonth;
|
||||
}
|
||||
|
||||
public void setYearMonth(Integer yearMonth) {
|
||||
this.yearMonth = yearMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造caseId
|
||||
*
|
||||
@ -743,9 +753,10 @@ public class OriginalResidenceSaleClosingCase {
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public String generateCaseId() {
|
||||
String text = getCaseCountyName() + getCaseAddress() + getCaseArea();
|
||||
if (null != getCaseSigningDate())
|
||||
String text = getCaseCountyName() + getCaseAddress();
|
||||
if (null != getCaseSigningDate()) {
|
||||
text += simplaDateFormat.format(getCaseSigningDate());
|
||||
}
|
||||
|
||||
return DigestUtils.md5DigestAsHex(text.getBytes());
|
||||
}
|
||||
@ -777,17 +788,23 @@ public class OriginalResidenceSaleClosingCase {
|
||||
* @return
|
||||
*/
|
||||
public Integer refineCurrentFloor() {
|
||||
if (StringUtils.isEmpty(getCaseAddress())) return null;
|
||||
if (StringUtils.isEmpty(getCaseAddress())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("(\\d+)(室)$");
|
||||
|
||||
Matcher matcher = pattern.matcher(getCaseAddress());
|
||||
if (!matcher.find()) return null;
|
||||
if (!matcher.find()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String value = matcher.group(1);
|
||||
Integer num = new Integer(value);
|
||||
if (num > 1000 || num > 100)
|
||||
if (num > 1000 || num > 100) {
|
||||
return num / 100;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -800,7 +817,9 @@ public class OriginalResidenceSaleClosingCase {
|
||||
* @return
|
||||
*/
|
||||
public String refineBuildingAddress() {
|
||||
if (StringUtils.isEmpty(getCaseAddress())) return null;
|
||||
if (StringUtils.isEmpty(getCaseAddress())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("(\\d+)室$");
|
||||
Matcher matcher = pattern.matcher(getCaseAddress());
|
||||
|
@ -1,32 +1,41 @@
|
||||
package com.ruoyi.project.data.cases.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 住宅住宅销售成交案例DAO
|
||||
*
|
||||
* @author lihe
|
||||
* @date 2020年7月10日
|
||||
*/
|
||||
@DS("compute")
|
||||
public interface OriginalResidenceSaleClosingCaseMapper {
|
||||
|
||||
/**
|
||||
* 创建表
|
||||
* 创建住宅销售成交案例表
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createTable(@Param("yearMonth") Integer yearMonth);
|
||||
int createRawTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 原始成交案例
|
||||
* @param yearMonth
|
||||
* 插入住宅销售成交案例
|
||||
*
|
||||
* @param originalResidenceSaleClosingCase
|
||||
* @return
|
||||
*/
|
||||
int createClosingCaseRawTable(@Param("yearMonth") Integer yearMonth);
|
||||
int insertRawTable(OriginalResidenceSaleClosingCase originalResidenceSaleClosingCase);
|
||||
|
||||
/**
|
||||
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
|
@ -7,6 +7,11 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住宅销售挂牌案例DAO
|
||||
*
|
||||
* @author lihe
|
||||
*/
|
||||
@DS("compute")
|
||||
public interface OriginalResidenceSaleOpeningCaseMapper {
|
||||
|
||||
@ -16,16 +21,15 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createTable(@Param("yearMonth") Integer yearMonth);
|
||||
int createRawTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 插入住宅销售挂牌案例
|
||||
*
|
||||
* @param yearMonth
|
||||
* @param originalResidenceSaleOpeningCase
|
||||
* @return
|
||||
*/
|
||||
int createOpeningCaseRawTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
|
||||
int insertRawTable(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
|
||||
|
||||
/**
|
||||
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
|
||||
@ -42,8 +46,10 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
|
||||
* @return
|
||||
*/
|
||||
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
* 作价表
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
@ -51,6 +57,7 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
|
||||
|
||||
/**
|
||||
* 人工修正价格表
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
@ -73,6 +80,8 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
|
||||
Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*
|
||||
* @param queryModel
|
||||
* @return
|
||||
*/
|
||||
|
@ -6,10 +6,19 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 下载住宅销售成交案例
|
||||
*
|
||||
* @author lihe
|
||||
* @date 2020年7月10日
|
||||
*/
|
||||
@DS("calc")
|
||||
public interface DownloadOriginalResidenceSaleClosingCaseMapper {
|
||||
|
||||
/**
|
||||
* 获取住宅销售成交案例
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
List<OriginalResidenceSaleClosingCase> download(@Param("yearMonth") Integer yearMonth);
|
||||
|
@ -5,10 +5,17 @@ import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 外网住住宅销售挂牌案例
|
||||
*
|
||||
* @author lihe
|
||||
*/
|
||||
@DS("oldProd")
|
||||
public interface DownloadOriginalResidenceSaleOpeningCaseMapper {
|
||||
|
||||
/**
|
||||
* 获取最新的住宅销售挂牌案例列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OriginalResidenceSaleOpeningCase> download();
|
||||
|
@ -4,20 +4,26 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 推送住宅销售挂牌案例DAO
|
||||
* @author lihe
|
||||
*/
|
||||
@DS("calc")
|
||||
public interface SyncOriginalResidenceSaleOpeningCaseMapper {
|
||||
|
||||
/**
|
||||
* 创建挂牌案例表
|
||||
*
|
||||
* @param yearMonth
|
||||
* @return
|
||||
*/
|
||||
int createTable(@Param("yearMonth") Integer yearMonth);
|
||||
int createRawTable(@Param("yearMonth") Integer yearMonth);
|
||||
|
||||
/**
|
||||
*
|
||||
* 插入挂牌案例表
|
||||
* @param originalResidenceSaleOpeningCase
|
||||
* @return
|
||||
*/
|
||||
int insert(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
|
||||
int insertRawTable(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,14 @@
|
||||
package com.ruoyi.project.data.cases.service;
|
||||
|
||||
/**
|
||||
* 住宅租赁案例SERVICE
|
||||
*
|
||||
* @author lihe
|
||||
* @date 2020年7月10日
|
||||
*/
|
||||
public interface IOriginalResidenceRentOpeningCaseService {
|
||||
/**
|
||||
* 挂牌案例数据下载
|
||||
*/
|
||||
void pullData();
|
||||
}
|
||||
|
@ -13,8 +13,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 定时下载一手房案例数据并且推送到联城数库中
|
||||
@ -130,15 +128,5 @@ public class DownloadOriginalNewHouseCaseServiceImpl {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Map<String, List<OriginalNewHouseCase>> originalNewHouseCasePerCaseId =
|
||||
// originalNewHouseCaseList.stream().collect(Collectors.groupingBy(OriginalNewHouseCase::getCaseId));
|
||||
//
|
||||
// originalNewHouseCasePerCaseId.entrySet().stream().filter(x -> x.getValue().size() > 1).forEach(caseIdGroup
|
||||
// -> {
|
||||
// caseIdGroup.getValue().stream().forEach(originalNewHouseCase -> {
|
||||
//
|
||||
// });
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,113 @@
|
||||
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.OriginalResidenceSaleClosingCase;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleClosingCaseMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时下载住宅销售成交案例
|
||||
* 来源: 8433 LC_DataCenter
|
||||
*
|
||||
* @author lihe
|
||||
* @date 2020年7月9日
|
||||
*/
|
||||
@Service
|
||||
@DS("compute")
|
||||
public class DownloadOriginalResidenceSaleClosingCaseServiceImpl {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DownloadOriginalResidenceSaleClosingCaseServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private OriginalResidenceSaleClosingCaseMapper originalResidenceSaleClosingCaseMapper;
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleClosingCaseMapper downloadOriginalResidenceSaleClosingCaseMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
* 每个月10号拉取
|
||||
*/
|
||||
public void download() {
|
||||
Integer remoteTableRoute = DateUtils.getLastYearMonth();
|
||||
Integer tableRoute = DateUtils.getNextYearMonth();
|
||||
|
||||
download(tableRoute, remoteTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableRoute
|
||||
* @param remoteTableRoute
|
||||
*/
|
||||
public void download(Integer tableRoute, Integer remoteTableRoute) {
|
||||
|
||||
/**
|
||||
* 删除原有表
|
||||
* 1. 创建成交案例原始表
|
||||
* 2. 创建成交案例清洗表
|
||||
* 3. 清洗成交案例
|
||||
*/
|
||||
before(tableRoute);
|
||||
|
||||
List<OriginalResidenceSaleClosingCase> originalResidenceSaleClosingCases =
|
||||
downloadOriginalResidenceSaleClosingCaseMapper.download(remoteTableRoute);
|
||||
|
||||
running(tableRoute, originalResidenceSaleClosingCases);
|
||||
after(tableRoute);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 准备工作
|
||||
*
|
||||
* @param tableRoute
|
||||
*/
|
||||
private void before(Integer tableRoute) {
|
||||
originalResidenceSaleClosingCaseMapper.createRawTable(tableRoute);
|
||||
originalResidenceSaleClosingCaseMapper.createCleanTable(tableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据入库
|
||||
*
|
||||
* @param tableRoute
|
||||
* @param originalResidenceSaleClosingCases
|
||||
*/
|
||||
private void running(Integer tableRoute,
|
||||
List<OriginalResidenceSaleClosingCase> originalResidenceSaleClosingCases) {
|
||||
|
||||
originalResidenceSaleClosingCases.parallelStream().forEach(originalResidenceSaleClosingCase -> {
|
||||
originalResidenceSaleClosingCase.setYearMonth(tableRoute);
|
||||
originalResidenceSaleClosingCase.setCaseId(originalResidenceSaleClosingCase.generateCaseId());
|
||||
originalResidenceSaleClosingCase.setCleanPropertyType(originalResidenceSaleClosingCase.refinePropertyType());
|
||||
originalResidenceSaleClosingCaseMapper.insertRawTable(originalResidenceSaleClosingCase);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 清洗成交案例
|
||||
*
|
||||
* @param tableRoute
|
||||
*/
|
||||
private void after(Integer tableRoute) {
|
||||
try {
|
||||
String rawSql = LoadUtil.loadContent("sql-template/clear_sale_closing_case.sql");
|
||||
String sql = rawSql.replace("#yearMonth#", tableRoute.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
} catch (Exception e) {
|
||||
logger.error("住宅销售成交案例清洗异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
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.OriginalResidenceSaleOpeningCase;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时下载住宅销售挂牌案例
|
||||
* 来源: 8433 LC_DataCenter
|
||||
*
|
||||
* @author lihe
|
||||
* @date 2020年7月9日
|
||||
*/
|
||||
@Service
|
||||
@DS("compute")
|
||||
public class DownloadOriginalResidenceSaleOpeningCaseServiceImpl {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DownloadOriginalResidenceSaleOpeningCaseServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
@Autowired
|
||||
private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper;
|
||||
@Autowired
|
||||
private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
* 每个月25号拉取
|
||||
*/
|
||||
public void download() {
|
||||
Integer tableRoute = DateUtils.getNextYearMonth();
|
||||
Integer remoteTableRoute = DateUtils.getLastYearMonth();
|
||||
|
||||
download(tableRoute, remoteTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableRoute
|
||||
* @param remoteTableRoute
|
||||
*/
|
||||
public void download(Integer tableRoute, Integer remoteTableRoute) {
|
||||
|
||||
/**
|
||||
* 删除原有表
|
||||
* 1. 下载数据
|
||||
* 2. 同步数据
|
||||
* 3. 创建表
|
||||
* 4. 插入数据
|
||||
* 5. 推送数据
|
||||
*/
|
||||
before(tableRoute, remoteTableRoute);
|
||||
|
||||
List<OriginalResidenceSaleOpeningCase> originalResidenceSaleOpeningCases =
|
||||
downloadOriginalResidenceSaleOpeningCaseMapper.download();
|
||||
|
||||
running(tableRoute, remoteTableRoute, originalResidenceSaleOpeningCases);
|
||||
after(tableRoute, remoteTableRoute);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 准备工作
|
||||
*
|
||||
* @param tableRoute
|
||||
* @param remoteTableRoute
|
||||
*/
|
||||
private void before(Integer tableRoute, Integer remoteTableRoute) {
|
||||
originalResidenceSaleOpeningCaseMapper.createRawTable(tableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createCleanTable(tableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createAssembleTable(tableRoute);
|
||||
syncOriginalResidenceSaleOpeningCaseMapper.createRawTable(remoteTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据入库
|
||||
*
|
||||
* @param tableRoute
|
||||
* @param remoteTableRoute
|
||||
*/
|
||||
private void running(Integer tableRoute, Integer remoteTableRoute,
|
||||
List<OriginalResidenceSaleOpeningCase> originalResidenceSaleOpeningCaseList) {
|
||||
|
||||
originalResidenceSaleOpeningCaseList.parallelStream().forEach(originalResidenceSaleOpeningCase -> {
|
||||
originalResidenceSaleOpeningCaseMapper.insertRawTable(originalResidenceSaleOpeningCase);
|
||||
syncOriginalResidenceSaleOpeningCaseMapper.insertRawTable(originalResidenceSaleOpeningCase);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算住宅基价
|
||||
*
|
||||
* @param tableRoute
|
||||
* @param remoteTableRoute
|
||||
*/
|
||||
private void after(Integer tableRoute, Integer remoteTableRoute) {
|
||||
try {
|
||||
// 清洗挂牌案例
|
||||
String rawSql = LoadUtil.loadContent("sql-template/clear_sale_opening_case.sql");
|
||||
String sql = rawSql.replace("#yearMonth#", tableRoute.toString())
|
||||
.replace("#lastYearMonth#", remoteTableRoute.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
|
||||
// 作价
|
||||
rawSql = LoadUtil.loadContent("sql-template/compute_sale_price.sql");
|
||||
sql = rawSql.replace("#yearMonth#", tableRoute.toString())
|
||||
.replace("#lastYearMonth#", remoteTableRoute.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
} catch (Exception e) {
|
||||
logger.error("住宅作价异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,113 +1,113 @@
|
||||
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.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 OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalResidenceSaleClosingCaseService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleClosingCaseServiceImpl.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 clear() {
|
||||
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));
|
||||
|
||||
// targetTableRoute = 202005;
|
||||
// computeTableRoute = 202007;
|
||||
|
||||
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) {
|
||||
// sql-template/.sql
|
||||
// String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_closing_case.sql");
|
||||
String rawSql = LoadUtil.loadContent("sql-template/clear_sale_closing_case.sql");
|
||||
String sql = rawSql.replace("#yearMonth#", yearMonth.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
}
|
||||
}
|
||||
//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.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 OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalResidenceSaleClosingCaseService {
|
||||
//
|
||||
// private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleClosingCaseServiceImpl.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 clear() {
|
||||
// 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));
|
||||
//
|
||||
//// targetTableRoute = 202005;
|
||||
//// computeTableRoute = 202007;
|
||||
//
|
||||
// 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.createRawTable(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) {
|
||||
// // sql-template/.sql
|
||||
//// String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_closing_case.sql");
|
||||
// String rawSql = LoadUtil.loadContent("sql-template/clear_sale_closing_case.sql");
|
||||
// String sql = rawSql.replace("#yearMonth#", yearMonth.toString());
|
||||
// jdbcTemplate.update(sql);
|
||||
// }
|
||||
//}
|
||||
|
@ -1,132 +1,132 @@
|
||||
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.OriginalResidenceSaleOpeningCase;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
|
||||
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.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DS("compute")
|
||||
public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper;
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
@Autowired
|
||||
private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper;
|
||||
@Autowired
|
||||
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Scheduled(cron = "0 0 5 25 * ?")
|
||||
@Override
|
||||
public void clear() {
|
||||
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));
|
||||
// computeTableRoute = 202007;
|
||||
// lastYearMonth = 202006;
|
||||
|
||||
prepare(computeTableRoute, syncTableRoute);
|
||||
List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download();
|
||||
list.parallelStream().forEach(originalResidenceOpeningCase -> {
|
||||
// originalResidenceOpeningCase.clear();
|
||||
// originalResidenceOpeningCase.setYearMonth(syncTableRoute);
|
||||
// syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase);
|
||||
});
|
||||
running(computeTableRoute, list);
|
||||
after(computeTableRoute, lastYearMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备工作 创建表
|
||||
*
|
||||
* @param computeTableRoute
|
||||
* @param syncTableRoute
|
||||
*/
|
||||
public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
|
||||
originalResidenceSaleOpeningCaseMapper.createOpeningCaseRawTable(computeTableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
|
||||
originalResidenceSaleOpeningCaseMapper.createUltimatePriceTable(computeTableRoute);
|
||||
// syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量入库
|
||||
*
|
||||
* @param computeTableRoute
|
||||
* @param list
|
||||
*/
|
||||
public void running(Integer computeTableRoute, List<OriginalResidenceSaleOpeningCase> list) {
|
||||
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
|
||||
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
|
||||
".ODS_HOUSINGCASELISTED_LJ_" + computeTableRoute + "_RAW(case_id, llid, lcid, Name, " +
|
||||
"Roomtype, Area, Towards, Storey, Lastdeal, Condoelev, Decoration, Year, Address, Price, " +
|
||||
"Cname, Visited_Num, First_Visit_Time, Visited_Num_15, Visited_Num_30, Url, Curl, CurlDate) " +
|
||||
"values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," +
|
||||
":caseApartmentLayout,:caseArea,:caseToward,:caseStorey,:caseLastDeal,:caseElevator" +
|
||||
",:caseDecoration,:caseYear,:caseAddress,:casePrice,:caseCommunityName,:caseVisitedNum," +
|
||||
":caseFirstVisitTime,:caseVisitedNum15,:caseVisitedNum30,:caseUrl,:caseCommunityUrl," +
|
||||
":caseGetDate);",
|
||||
batchParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配数据
|
||||
* 计算基价
|
||||
*
|
||||
* @param yearMonth
|
||||
* @param lastYearMonth
|
||||
*/
|
||||
public void after(Integer yearMonth, Integer lastYearMonth) {
|
||||
// 清洗挂牌案例
|
||||
|
||||
String rawSql = LoadUtil.loadContent("sql-template/clear_sale_opening_case.sql");
|
||||
// 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);
|
||||
|
||||
// 作价
|
||||
rawSql = LoadUtil.loadContent("sql-template/compute_sale_price.sql");
|
||||
sql = rawSql.replace("#yearMonth#", yearMonth.toString())
|
||||
.replace("#lastYearMonth#", lastYearMonth.toString());
|
||||
jdbcTemplate.update(sql);
|
||||
|
||||
logger.debug("#作价完成#");
|
||||
}
|
||||
}
|
||||
//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.OriginalResidenceSaleOpeningCase;
|
||||
//import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper;
|
||||
//import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
//import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
|
||||
//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.util.Calendar;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@Service
|
||||
//@DS("compute")
|
||||
//public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService {
|
||||
//
|
||||
// private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class);
|
||||
//
|
||||
// @Autowired
|
||||
// private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper;
|
||||
// @Autowired
|
||||
// private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper;
|
||||
// @Autowired
|
||||
// private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper;
|
||||
// @Autowired
|
||||
// private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
// @Autowired
|
||||
// private JdbcTemplate jdbcTemplate;
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// @Scheduled(cron = "0 0 5 25 * ?")
|
||||
// @Override
|
||||
// public void clear() {
|
||||
// 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));
|
||||
//// computeTableRoute = 202007;
|
||||
//// lastYearMonth = 202006;
|
||||
//
|
||||
// prepare(computeTableRoute, syncTableRoute);
|
||||
// List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download();
|
||||
// list.parallelStream().forEach(originalResidenceOpeningCase -> {
|
||||
//// originalResidenceOpeningCase.clear();
|
||||
//// originalResidenceOpeningCase.setYearMonth(syncTableRoute);
|
||||
//// syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase);
|
||||
// });
|
||||
// running(computeTableRoute, list);
|
||||
// after(computeTableRoute, lastYearMonth);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 准备工作 创建表
|
||||
// *
|
||||
// * @param computeTableRoute
|
||||
// * @param syncTableRoute
|
||||
// */
|
||||
// public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
|
||||
// originalResidenceSaleOpeningCaseMapper.createRawTable(computeTableRoute);
|
||||
// originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute);
|
||||
// originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute);
|
||||
// originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute);
|
||||
// originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
|
||||
// originalResidenceSaleOpeningCaseMapper.createUltimatePriceTable(computeTableRoute);
|
||||
//// syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量入库
|
||||
// *
|
||||
// * @param computeTableRoute
|
||||
// * @param list
|
||||
// */
|
||||
// public void running(Integer computeTableRoute, List<OriginalResidenceSaleOpeningCase> list) {
|
||||
// SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
|
||||
// int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
|
||||
// ".ODS_HOUSINGCASELISTED_LJ_" + computeTableRoute + "_RAW(case_id, llid, lcid, Name, " +
|
||||
// "Roomtype, Area, Towards, Storey, Lastdeal, Condoelev, Decoration, Year, Address, Price, " +
|
||||
// "Cname, Visited_Num, First_Visit_Time, Visited_Num_15, Visited_Num_30, Url, Curl, CurlDate) " +
|
||||
// "values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," +
|
||||
// ":caseApartmentLayout,:caseArea,:caseToward,:caseStorey,:caseLastDeal,:caseElevator" +
|
||||
// ",:caseDecoration,:caseYear,:caseAddress,:casePrice,:caseCommunityName,:caseVisitedNum," +
|
||||
// ":caseFirstVisitTime,:caseVisitedNum15,:caseVisitedNum30,:caseUrl,:caseCommunityUrl," +
|
||||
// ":caseGetDate);",
|
||||
// batchParams);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 匹配数据
|
||||
// * 计算基价
|
||||
// *
|
||||
// * @param yearMonth
|
||||
// * @param lastYearMonth
|
||||
// */
|
||||
// public void after(Integer yearMonth, Integer lastYearMonth) {
|
||||
// // 清洗挂牌案例
|
||||
//
|
||||
// String rawSql = LoadUtil.loadContent("sql-template/clear_sale_opening_case.sql");
|
||||
//// 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);
|
||||
//
|
||||
// // 作价
|
||||
// rawSql = LoadUtil.loadContent("sql-template/compute_sale_price.sql");
|
||||
// sql = rawSql.replace("#yearMonth#", yearMonth.toString())
|
||||
// .replace("#lastYearMonth#", lastYearMonth.toString());
|
||||
// jdbcTemplate.update(sql);
|
||||
//
|
||||
// logger.debug("#作价完成#");
|
||||
// }
|
||||
//}
|
||||
|
@ -4,42 +4,41 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper">
|
||||
|
||||
<update id="createRawClosingCaseTable">
|
||||
<bind name="targetTableName" value="'dbo.二手房成交数据' + yearMonth" />
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
<!-- <update id="createRawClosingCaseTable">-->
|
||||
<!-- <bind name="targetTableName" value="'dbo.二手房成交数据' + yearMonth" />-->
|
||||
<!-- IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL-->
|
||||
<!-- drop table ${targetTableName};-->
|
||||
|
||||
create table ${targetTableName}
|
||||
(
|
||||
case_id uniqueidentifier not null primary key,
|
||||
区域 varchar (255) NULL,
|
||||
板块 varchar (255) NULL,
|
||||
环线 varchar (255) NULL,
|
||||
小区名称 varchar (255) NULL,
|
||||
房屋地址 varchar (255) NULL,
|
||||
面积 float NULL,
|
||||
房屋类型 varchar (255) NULL,
|
||||
总价 float NULL,
|
||||
单价 float NULL,
|
||||
登记日期 varchar (255) NULL,
|
||||
签约日期 varchar (255) NULL,
|
||||
中介公司 varchar (255) NULL,
|
||||
中介类型 varchar (255) NULL,
|
||||
卖家类型 float NULL,
|
||||
买家类型 varchar (5) NULL,
|
||||
出生年月日 varchar (5) NULL
|
||||
)
|
||||
</update>
|
||||
<!-- create table ${targetTableName}-->
|
||||
<!-- (-->
|
||||
<!-- case_id uniqueidentifier not null primary key,-->
|
||||
<!-- 区域 varchar (255) NULL,-->
|
||||
<!-- 板块 varchar (255) NULL,-->
|
||||
<!-- 环线 varchar (255) NULL,-->
|
||||
<!-- 小区名称 varchar (255) NULL,-->
|
||||
<!-- 房屋地址 varchar (255) NULL,-->
|
||||
<!-- 面积 float NULL,-->
|
||||
<!-- 房屋类型 varchar (255) NULL,-->
|
||||
<!-- 总价 float NULL,-->
|
||||
<!-- 单价 float NULL,-->
|
||||
<!-- 登记日期 varchar (255) NULL,-->
|
||||
<!-- 签约日期 varchar (255) NULL,-->
|
||||
<!-- 中介公司 varchar (255) NULL,-->
|
||||
<!-- 中介类型 varchar (255) NULL,-->
|
||||
<!-- 卖家类型 float NULL,-->
|
||||
<!-- 买家类型 varchar (5) NULL,-->
|
||||
<!-- 出生年月日 varchar (5) NULL-->
|
||||
<!-- )-->
|
||||
<!-- </update>-->
|
||||
|
||||
<!-- 外部数据重复问题 -->
|
||||
<update id="createTable">
|
||||
<update id="createRawTable">
|
||||
<bind name="targetTableName" value="'dbo.original_residence_sale_closing_case_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
(
|
||||
id int identity(1,1) not null,
|
||||
case_id varchar(32) not null,
|
||||
case_county_name nvarchar(20) null,
|
||||
case_block_name nvarchar(20) null,
|
||||
@ -99,4 +98,52 @@
|
||||
DateContract date NULL
|
||||
);
|
||||
</update>
|
||||
<insert id="insertRawTable" parameterType="com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase">
|
||||
<bind name="targetTableName" value="'dbo.original_residence_sale_closing_case_' + yearMonth"/>
|
||||
insert into ${targetTableName}
|
||||
(
|
||||
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,jdbcType=DATE},
|
||||
#{caseRegisterDate,jdbcType=DATE},
|
||||
#{agencyName},
|
||||
#{agencyType},
|
||||
#{sellerType},
|
||||
#{buyerType},
|
||||
#{birthday,jdbcType=DATE},
|
||||
2,
|
||||
#{cleanPropertyType},
|
||||
getdate()
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
@ -4,146 +4,146 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper">
|
||||
<!--案例原始表-->
|
||||
<update id="createOpeningCaseRawTable">
|
||||
<update id="createRawTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth +'_RAW'"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
drop table ${targetTableName};
|
||||
|
||||
create table ${targetTableName}
|
||||
(
|
||||
case_id varchar (32) not null primary key
|
||||
, llid bigint
|
||||
, lcid bigint
|
||||
, Name sql_variant
|
||||
, Roomtype nvarchar(50)
|
||||
, Area decimal(18, 2)
|
||||
, Towards nvarchar(50)
|
||||
, Storey nvarchar(50)
|
||||
, Lastdeal date
|
||||
, Condoelev nvarchar(50)
|
||||
, Decoration nvarchar(50)
|
||||
, Year int
|
||||
, Address nvarchar(1024)
|
||||
, Price decimal(18, 2)
|
||||
, Cname nvarchar(1024)
|
||||
, Visited_Num int
|
||||
, First_Visit_Time date
|
||||
, Visited_Num_15 int
|
||||
, Visited_Num_30 int
|
||||
, Url nvarchar(512)
|
||||
, Curl nvarchar(512)
|
||||
, CurlDate date
|
||||
case_id varchar (32) not null primary key
|
||||
, llid bigint
|
||||
, lcid bigint
|
||||
, Name sql_variant
|
||||
, Roomtype nvarchar(50)
|
||||
, Area decimal(18, 2)
|
||||
, Towards nvarchar(50)
|
||||
, Storey nvarchar(50)
|
||||
, Lastdeal date
|
||||
, Condoelev nvarchar(50)
|
||||
, Decoration nvarchar(50)
|
||||
, Year int
|
||||
, Address nvarchar(1024)
|
||||
, Price decimal(18, 2)
|
||||
, Cname nvarchar(1024)
|
||||
, Visited_Num int
|
||||
, First_Visit_Time date
|
||||
, Visited_Num_15 int
|
||||
, Visited_Num_30 int
|
||||
, Url nvarchar(512)
|
||||
, Curl nvarchar(512)
|
||||
, CurlDate date
|
||||
);
|
||||
</update>
|
||||
<!--过时-->
|
||||
<update id="createTable">
|
||||
<bind name="targetTableName" value="'dbo.original_residence_sale_opening_case_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
<!--原始数据-->
|
||||
<!-- <update id="createRawTable">-->
|
||||
<!-- <bind name="targetTableName" value="'dbo.original_residence_sale_opening_case_' + yearMonth"/>-->
|
||||
<!-- IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL-->
|
||||
<!-- drop table ${targetTableName};-->
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
(
|
||||
case_id varchar (32) NOT NULL,
|
||||
case_lianjia_id nvarchar (50) NOT null primary key,
|
||||
case_lianjia_community_id nvarchar (50) NOT NULL,
|
||||
case_title nvarchar (500) NOT NULL,
|
||||
clean_property_type nvarchar (20) NULL,
|
||||
case_apartment_layout nvarchar (500) NOT NULL,
|
||||
case_house_structure nvarchar (50) NULL,
|
||||
case_area decimal (10, 2) NOT NULL,
|
||||
case_underground_area decimal (10, 2) NULL,
|
||||
case_toward nvarchar (50) NOT NULL,
|
||||
clean_toward nvarchar (50) NULL,
|
||||
case_storey nvarchar (20) NOT NULL,
|
||||
clean_total_floor int NOT NULL,
|
||||
clean_current_floor_desc nvarchar (20) NULL,
|
||||
case_elevator nvarchar (20) NULL,
|
||||
clean_elevator nvarchar (20) NULL,
|
||||
case_tihu nvarchar (20) NULL,
|
||||
case_decoration nvarchar (20) NULL,
|
||||
clean_decoration nvarchar (50) NULL,
|
||||
case_year int NOT NULL,
|
||||
clean_year int NOT NULL,
|
||||
case_address nvarchar (500) NULL,
|
||||
case_vid nvarchar (500) NULL,
|
||||
case_chan_quan_xing_zhi nvarchar (200) NULL,
|
||||
case_price decimal (18, 2) NOT NULL,
|
||||
clean_unit_price decimal (18, 2) NOT NULL,
|
||||
clean_total_price decimal (18, 2) NOT NULL,
|
||||
case_community_name nvarchar (500) NULL,
|
||||
case_visited_num int NOT NULL,
|
||||
case_visited_num_15 int NOT NULL,
|
||||
case_visited_num_30 int NOT NULL,
|
||||
case_latest_deal_date date NULL,
|
||||
case_latest_visited_date date NULL,
|
||||
case_first_visited_date date NULL,
|
||||
case_url nvarchar (500) NOT NULL,
|
||||
case_community_url nvarchar (500) NOT NULL,
|
||||
case_get_date date NOT NULL,
|
||||
case_provider nvarchar (50) NOT NULL,
|
||||
uv_community_name nvarchar (500) NULL,
|
||||
uv_community_address nvarchar (1024) NULL,
|
||||
uv_community_id nvarchar (20) NULL,
|
||||
uv_building_id nvarchar (20) NULL,
|
||||
uv_county nvarchar (50) NULL,
|
||||
uv_block nvarchar (50) NULL,
|
||||
uv_loop nvarchar (50) NULL,
|
||||
area_coefficient decimal (18, 6) NULL,
|
||||
toward_coefficient decimal (18, 6) NULL,
|
||||
floor_coefficient decimal (18, 6) NULL,
|
||||
decoration_coefficient int NULL,
|
||||
year_coefficient decimal (18, 6) NULL,
|
||||
building_coefficient decimal (18, 6) NULL,
|
||||
adjust_unit_price decimal (18, 2) NULL,
|
||||
clean_project_level nvarchar (50) NULL,
|
||||
create_time datetime NOT NULL
|
||||
);
|
||||
</update>
|
||||
<!-- CREATE TABLE ${targetTableName}-->
|
||||
<!-- (-->
|
||||
<!-- case_id varchar (32) NOT NULL,-->
|
||||
<!-- case_lianjia_id nvarchar (50) NOT null primary key,-->
|
||||
<!-- case_lianjia_community_id nvarchar (50) NOT NULL,-->
|
||||
<!-- case_title nvarchar (500) NOT NULL,-->
|
||||
<!-- clean_property_type nvarchar (20) NULL,-->
|
||||
<!-- case_apartment_layout nvarchar (500) NOT NULL,-->
|
||||
<!-- case_house_structure nvarchar (50) NULL,-->
|
||||
<!-- case_area decimal (10, 2) NOT NULL,-->
|
||||
<!-- case_underground_area decimal (10, 2) NULL,-->
|
||||
<!-- case_toward nvarchar (50) NOT NULL,-->
|
||||
<!-- clean_toward nvarchar (50) NULL,-->
|
||||
<!-- case_storey nvarchar (20) NOT NULL,-->
|
||||
<!-- clean_total_floor int NOT NULL,-->
|
||||
<!-- clean_current_floor_desc nvarchar (20) NULL,-->
|
||||
<!-- case_elevator nvarchar (20) NULL,-->
|
||||
<!-- clean_elevator nvarchar (20) NULL,-->
|
||||
<!-- case_tihu nvarchar (20) NULL,-->
|
||||
<!-- case_decoration nvarchar (20) NULL,-->
|
||||
<!-- clean_decoration nvarchar (50) NULL,-->
|
||||
<!-- case_year int NOT NULL,-->
|
||||
<!-- clean_year int NOT NULL,-->
|
||||
<!-- case_address nvarchar (500) NULL,-->
|
||||
<!-- case_vid nvarchar (500) NULL,-->
|
||||
<!-- case_chan_quan_xing_zhi nvarchar (200) NULL,-->
|
||||
<!-- case_price decimal (18, 2) NOT NULL,-->
|
||||
<!-- clean_unit_price decimal (18, 2) NOT NULL,-->
|
||||
<!-- clean_total_price decimal (18, 2) NOT NULL,-->
|
||||
<!-- case_community_name nvarchar (500) NULL,-->
|
||||
<!-- case_visited_num int NOT NULL,-->
|
||||
<!-- case_visited_num_15 int NOT NULL,-->
|
||||
<!-- case_visited_num_30 int NOT NULL,-->
|
||||
<!-- case_latest_deal_date date NULL,-->
|
||||
<!-- case_latest_visited_date date NULL,-->
|
||||
<!-- case_first_visited_date date NULL,-->
|
||||
<!-- case_url nvarchar (500) NOT NULL,-->
|
||||
<!-- case_community_url nvarchar (500) NOT NULL,-->
|
||||
<!-- case_get_date date NOT NULL,-->
|
||||
<!-- case_provider nvarchar (50) NOT NULL,-->
|
||||
<!-- uv_community_name nvarchar (500) NULL,-->
|
||||
<!-- uv_community_address nvarchar (1024) NULL,-->
|
||||
<!-- uv_community_id nvarchar (20) NULL,-->
|
||||
<!-- uv_building_id nvarchar (20) NULL,-->
|
||||
<!-- uv_county nvarchar (50) NULL,-->
|
||||
<!-- uv_block nvarchar (50) NULL,-->
|
||||
<!-- uv_loop nvarchar (50) NULL,-->
|
||||
<!-- area_coefficient decimal (18, 6) NULL,-->
|
||||
<!-- toward_coefficient decimal (18, 6) NULL,-->
|
||||
<!-- floor_coefficient decimal (18, 6) NULL,-->
|
||||
<!-- decoration_coefficient int NULL,-->
|
||||
<!-- year_coefficient decimal (18, 6) NULL,-->
|
||||
<!-- building_coefficient decimal (18, 6) NULL,-->
|
||||
<!-- adjust_unit_price decimal (18, 2) NULL,-->
|
||||
<!-- clean_project_level nvarchar (50) NULL,-->
|
||||
<!-- create_time datetime NOT NULL-->
|
||||
<!-- );-->
|
||||
<!-- </update>-->
|
||||
<!--清洗表-->
|
||||
<update id="createCleanTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
|
||||
drop table ${targetTableName};
|
||||
drop table ${targetTableName};
|
||||
|
||||
CREATE TABLE ${targetTableName}
|
||||
(
|
||||
case_id varchar(32) not null,
|
||||
HouseholdsID_LJ bigint not null primary key,
|
||||
ProjectID_LJ bigint null,
|
||||
ProjectID bigint null,
|
||||
Roomtype nvarchar(64) null,
|
||||
Area decimal(18, 2) null,
|
||||
Towards nvarchar(64) null,
|
||||
UpperFloorSum nvarchar(32) null,
|
||||
UpperFloorNum nvarchar(32) null,
|
||||
Elevator tinyint null,
|
||||
Decoration nvarchar(64) null,
|
||||
Year int null,
|
||||
AreaCoff decimal(7, 4) null,
|
||||
TowardsCoff decimal(7, 4) null,
|
||||
FloorCoff decimal(7, 4) null,
|
||||
DecorationRng int null,
|
||||
YearCoff decimal(7, 4) null,
|
||||
BuildingCoff decimal(7, 4) null,
|
||||
PriceTotal decimal(18, 2) null,
|
||||
PriceUnit decimal(18, 2) not null,
|
||||
PriceUnitAdj decimal(18, 2) not null,
|
||||
Visited_Num int null,
|
||||
First_Visit_Time date null,
|
||||
Visited_Num_15 int null,
|
||||
Visited_Num_30 int null,
|
||||
Status tinyint null,
|
||||
AdjustedValue decimal(18, 2) null,
|
||||
AdjustedPst decimal(18, 6) null,
|
||||
AdjustedCumValue decimal(18, 2) null,
|
||||
AdjustedCumPst decimal(18, 6) null,
|
||||
AdjustedCumValueAbs decimal(18, 2) null,
|
||||
AdjustedCumPstAbs decimal(18, 6) null,
|
||||
AdjustedCumNum int null,
|
||||
PriceTotalIn decimal(18, 2) null,
|
||||
PriceTotalOut decimal(18, 2) null,
|
||||
PriceDateIn date null,
|
||||
PriceDateOut date null
|
||||
case_id varchar(32) not null,
|
||||
HouseholdsID_LJ bigint not null primary key,
|
||||
ProjectID_LJ bigint null,
|
||||
ProjectID bigint null,
|
||||
Roomtype nvarchar(64) null,
|
||||
Area decimal(18, 2) null,
|
||||
Towards nvarchar(64) null,
|
||||
UpperFloorSum nvarchar(32) null,
|
||||
UpperFloorNum nvarchar(32) null,
|
||||
Elevator tinyint null,
|
||||
Decoration nvarchar(64) null,
|
||||
Year int null,
|
||||
AreaCoff decimal(7, 4) null,
|
||||
TowardsCoff decimal(7, 4) null,
|
||||
FloorCoff decimal(7, 4) null,
|
||||
DecorationRng int null,
|
||||
YearCoff decimal(7, 4) null,
|
||||
BuildingCoff decimal(7, 4) null,
|
||||
PriceTotal decimal(18, 2) null,
|
||||
PriceUnit decimal(18, 2) not null,
|
||||
PriceUnitAdj decimal(18, 2) not null,
|
||||
Visited_Num int null,
|
||||
First_Visit_Time date null,
|
||||
Visited_Num_15 int null,
|
||||
Visited_Num_30 int null,
|
||||
Status tinyint null,
|
||||
AdjustedValue decimal(18, 2) null,
|
||||
AdjustedPst decimal(18, 6) null,
|
||||
AdjustedCumValue decimal(18, 2) null,
|
||||
AdjustedCumPst decimal(18, 6) null,
|
||||
AdjustedCumValueAbs decimal(18, 2) null,
|
||||
AdjustedCumPstAbs decimal(18, 6) null,
|
||||
AdjustedCumNum int null,
|
||||
PriceTotalIn decimal(18, 2) null,
|
||||
PriceTotalOut decimal(18, 2) null,
|
||||
PriceDateIn date null,
|
||||
PriceDateOut date null
|
||||
);
|
||||
</update>
|
||||
<!-- 案例汇总表 -->
|
||||
|
@ -3,7 +3,7 @@
|
||||
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.SyncOriginalResidenceSaleOpeningCaseMapper">
|
||||
<update id="createTable">
|
||||
<update id="createRawTable">
|
||||
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth + '_RAW'"/>
|
||||
IF OBJECT_ID(#{targetTableName}, 'U') IS NULL
|
||||
CREATE TABLE ${targetTableName}
|
||||
@ -35,7 +35,7 @@
|
||||
truncate table ${targetTableName}
|
||||
</update>
|
||||
|
||||
<insert id="insert" parameterType="com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase">
|
||||
<insert id="insertRawTable" parameterType="com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase">
|
||||
insert into dbo.ODS_HOUSINGCASELISTED_LJ_${yearMonth}_RAW
|
||||
(
|
||||
llid
|
||||
|
@ -1,5 +1,7 @@
|
||||
----建临时表#HousingCaseListAdj, 插入挂牌清洗数据
|
||||
------ 20200312BUG修复:朝向处理规则优化
|
||||
truncate table Ods_HousingCaseListed_LJ_#yearMonth#
|
||||
|
||||
--建临时表#HousingCaseListAdj, 插入挂牌清洗数据
|
||||
-- 20200312BUG修复:朝向处理规则优化
|
||||
create table #HousingCaseListAdj
|
||||
(
|
||||
case_id varchar(32) not null
|
||||
@ -97,7 +99,7 @@ DEALLOCATE Record2Insert
|
||||
SET NOCOUNT OFF
|
||||
|
||||
|
||||
----案例标准化
|
||||
--案例标准化
|
||||
create table #HousingCaseListSTD
|
||||
(
|
||||
HouseholdsID_LJ bigint
|
||||
@ -122,58 +124,58 @@ SELECT A.HouseholdsID_LJ, A.ProjectID_LJ, B.ProjectID, B.BuildingID,
|
||||
FROM #HousingCaseListAdj A
|
||||
LEFT JOIN obpm_LianCheng_Data.dbo.DIM_PROJECTID_LJ2AI B
|
||||
ON A.ProjectID_LJ = B.ProjectID_LJ
|
||||
left join (select * from uv_compute.dbo.ODS_PROJECT_INFO_202004 WHERE EffDate <= GETDATE() and ExpirDate > GETDATE() ) C
|
||||
on B.ProjectID = C.ProjectID
|
||||
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='面积修正(链家挂牌)') D --面积修正
|
||||
on D.ProjectType = '公寓' and C.ProjectLevel = D.ProjectLevel and ( A.Area > D.LowerKey and A.Area <= D.UpperKey)
|
||||
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='朝向(链家挂牌)') E --朝向修正
|
||||
on E.ProjectType = '公寓' and A.Towards = E.SingleKey
|
||||
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='楼层(链家挂牌)') F --楼层修正
|
||||
on F.ProjectType = '公寓' and isnull(A.Elevator,99)=isnull(F.Elevator,99) and A.UpperFloorSum = F.UpperKey and A.UpperFloorNum = F.LowerKey
|
||||
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='室内装修(链家挂牌)') G --装修修正
|
||||
on G.ProjectType = '公寓' and A.Decoration = G.SingleKey
|
||||
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='竣工日期') H --竣工日期修正
|
||||
on H.ProjectType = '公寓' and A.[Year]=H.SingleKey
|
||||
left join (select CommunityId,ProjectLevel from uv_compute.dbo.ResidenceCommunity) C
|
||||
on B.ProjectID = C.CommunityId
|
||||
LEFT JOIN (SELECT ProjectLevel,LowerKey,UpperKey,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 Elevator,UpperKey,LowerKey,Coefficient FROM obpm_LianCheng_Data.dbo.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 SingleKey,Coefficient FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='室内装修(链家挂牌)' and ProjectType = '公寓') G --装修修正
|
||||
on A.Decoration = G.SingleKey
|
||||
LEFT JOIN (SELECT SingleKey,Coefficient FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='竣工日期' and ProjectType = '公寓') H --竣工日期修正
|
||||
on A.[Year]=H.SingleKey
|
||||
LEFT JOIN obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF I
|
||||
on B.BuildingID = I.BuildingID;
|
||||
|
||||
|
||||
--当月拍照表调价信息
|
||||
--- 20200205BUG修复:AdjustedValue、AdjustedPst 中当Status=1时,值不为0的问题
|
||||
select
|
||||
a.HouseholdsID_LJ,
|
||||
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 0 -- 20200205修改
|
||||
when b.Status is null then 0
|
||||
else a.PriceTotal-b.PriceTotal end AdjustedValue,
|
||||
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
|
||||
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 null then getdate() else b.PriceDateIn end PriceDateIn,
|
||||
cast(NULL as date) as PriceDateOut
|
||||
into #HousingCaseListStatic
|
||||
from #HousingCaseListAdj a
|
||||
left join Ods_HousingCaseListed_LJ_#lastYearMonth# b
|
||||
on a.HouseholdsID_LJ = b.HouseholdsID_LJ;
|
||||
-- 20200205BUG修复:AdjustedValue、AdjustedPst 中当Status=1时,值不为0的问题
|
||||
select
|
||||
a.HouseholdsID_LJ,
|
||||
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 0 -- 20200205修改
|
||||
when b.Status is null then 0
|
||||
else a.PriceTotal-b.PriceTotal end AdjustedValue,
|
||||
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
|
||||
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 null then getdate() else b.PriceDateIn end PriceDateIn,
|
||||
cast(NULL as date) as PriceDateOut
|
||||
into #HousingCaseListStatic
|
||||
from #HousingCaseListAdj a
|
||||
left join Ods_HousingCaseListed_LJ_#lastYearMonth# b
|
||||
on a.HouseholdsID_LJ = b.HouseholdsID_LJ;
|
||||
|
||||
--插入当月未下架(活跃)案例数据
|
||||
insert into Ods_HousingCaseListed_LJ_#yearMonth#
|
||||
@ -207,7 +209,6 @@ insert into dbo.Ods_HousingCaseListed_LJ_#yearMonth# select * from #TmpRecordAdd
|
||||
|
||||
|
||||
/*插入历史下架记录*/
|
||||
|
||||
select a.case_id,a.HouseholdsID_LJ, a.ProjectID_LJ, a.ProjectID, a.Roomtype, 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.PriceTotal, a.PriceUnit, a.PriceUnitAdj,
|
||||
a.Visited_Num, a.First_Visit_Time, a.Visited_Num_15, a.Visited_Num_30, 5 as Status,
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.ruoyi;
|
||||
|
||||
|
||||
import com.ruoyi.project.data.cases.domain.CleanResidenceRentAggregationCase;
|
||||
import com.ruoyi.project.data.cases.domain.OfficeAggregationCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalNewHouseCase;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentClosingCase;
|
||||
import com.ruoyi.project.data.cases.domain.*;
|
||||
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
|
||||
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
|
||||
import org.junit.Assert;
|
||||
@ -96,7 +93,7 @@ public class GenerateTableTests {
|
||||
|
||||
@Test
|
||||
public void generateBatchGuoHaoInsertSqL() {
|
||||
Class targetClass = OriginalNewHouseCase.class;
|
||||
Class targetClass = OriginalResidenceSaleClosingCase .class;
|
||||
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
while (targetClass != null) {
|
||||
@ -135,6 +132,21 @@ public class GenerateTableTests {
|
||||
Assert.assertEquals("4868c51874ba68c7fa2c96eeac02cde7",originalNewHouseCase.getCaseId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void print2019Query(){
|
||||
for (int i = 201901; i <= 201912; i++) {
|
||||
System.out.println("SELECT * FROM dbo.一手房成交数据"+i+" where 房屋地址='联茂路80号1层';");
|
||||
System.out.println("SELECT * FROM dbo.一手房成交数据"+i+"_update where 房屋地址='联茂路80号1层';");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void print2020Query(){
|
||||
for (int i = 202001; i <= 202006; i++) {
|
||||
System.out.println("SELECT * FROM dbo.一手房成交数据"+i+" where 房屋地址='联茂路80号1层';");
|
||||
System.out.println("SELECT * FROM dbo.一手房成交数据"+i+"_update where 房屋地址='联茂路80号1层';");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,11 @@ public class DownloadOriginalNewHouseCaseServiceImplTests {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(201901);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownload202003First() {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(202003);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadLastYearSecondLoop() {
|
||||
Arrays.asList(201901, 201902, 201903, 201904, 201905, 201906, 201907, 201908, 201909, 201910, 201911, 201912).parallelStream().forEach(i -> {
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.ruoyi.compute;
|
||||
|
||||
import com.ruoyi.RuoYiApplication;
|
||||
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalResidenceSaleClosingCaseServiceImpl;
|
||||
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;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RuoYiApplication.class)
|
||||
@ActiveProfiles("dev")
|
||||
public class DownloadOriginalResidenceSaleClosingCaseServiceImplTests {
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleClosingCaseServiceImpl downloadOriginalResidenceSaleClosingCaseService;
|
||||
|
||||
@Test
|
||||
public void testDownload() {
|
||||
downloadOriginalResidenceSaleClosingCaseService.download(202007, 202005);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user