feature (住宅销售作价): 实现定时住宅销售基价作价

1. 住宅销售成交案例
2. 住宅销售挂牌案例
3. 案例清洗
4. 作价
This commit is contained in:
purple
2020-07-10 15:23:43 +08:00
parent 1320329f03
commit 0fb4e5901b
21 changed files with 975 additions and 545 deletions

View File

@ -3,7 +3,9 @@ package com.ruoyi.common.utils;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
/** /**
@ -11,11 +13,11 @@ import org.apache.commons.lang3.time.DateFormatUtils;
* *
* @author ruoyi * @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 = "yyyy";
public static String YYYY_MM = "yyyy-MM"; public static String YYYY_MM = "yyyy-MM";
public static String YYYYMM = "yyyyMM";
public static String YYYY_MM_DD = "yyyy-MM-dd"; public static String YYYY_MM_DD = "yyyy-MM-dd";
@ -33,8 +35,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
* *
* @return Date() 当前日期 * @return Date() 当前日期
*/ */
public static Date getNowDate() public static Date getNowDate() {
{
return new Date(); return new Date();
} }
@ -43,44 +44,61 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
* *
* @return String * @return String
*/ */
public static String getDate() public static String getDate() {
{
return dateTimeNow(YYYY_MM_DD); 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); return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
} }
public static final String dateTimeNow() public static final String dateTimeNow() {
{
return dateTimeNow(YYYYMMDDHHMMSS); return dateTimeNow(YYYYMMDDHHMMSS);
} }
public static final String dateTimeNow(final String format) public static final String dateTimeNow(final String format) {
{
return parseDateToStr(format, new Date()); 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); 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); return new SimpleDateFormat(format).format(date);
} }
public static final Date dateTime(final String format, final String ts) public static final Date dateTime(final String format, final String ts) {
{ try {
try
{
return new SimpleDateFormat(format).parse(ts); return new SimpleDateFormat(format).parse(ts);
} } catch (ParseException e) {
catch (ParseException e)
{
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -88,8 +106,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
/** /**
* 日期路径 即年/月/日 如2018/08/08 * 日期路径 即年/月/日 如2018/08/08
*/ */
public static final String datePath() public static final String datePath() {
{
Date now = new Date(); Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd"); return DateFormatUtils.format(now, "yyyy/MM/dd");
} }
@ -97,27 +114,22 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
/** /**
* 日期路径 即年/月/日 如20180808 * 日期路径 即年/月/日 如20180808
*/ */
public static final String dateTime() public static final String dateTime() {
{
Date now = new Date(); Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd"); return DateFormatUtils.format(now, "yyyyMMdd");
} }
/** /**
* 日期型字符串转化为日期 格式 * 日期型字符串转化为日期 格式
*/ */
public static Date parseDate(Object str) public static Date parseDate(Object str) {
{ if (str == null) {
if (str == null)
{
return null; return null;
} }
try try {
{
return parseDate(str.toString(), parsePatterns); return parseDate(str.toString(), parsePatterns);
} } catch (ParseException e) {
catch (ParseException e)
{
return null; return null;
} }
} }
@ -125,8 +137,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
/** /**
* 获取服务器启动时间 * 获取服务器启动时间
*/ */
public static Date getServerStartDate() public static Date getServerStartDate() {
{
long time = ManagementFactory.getRuntimeMXBean().getStartTime(); long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time); 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 nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60; long nh = 1000 * 60 * 60;
long nm = 1000 * 60; long nm = 1000 * 60;

View File

@ -1,5 +1,9 @@
package com.ruoyi.framework.task; 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 org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -9,20 +13,51 @@ import com.ruoyi.common.utils.StringUtils;
* @author ruoyi * @author ruoyi
*/ */
@Component("ryTask") @Component("ryTask")
public class RyTask public class RyTask {
{
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) @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)); System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
} }
public void ryParams(String params) public void ryParams(String params) {
{
System.out.println("执行有参方法:" + params); System.out.println("执行有参方法:" + params);
} }
public void ryNoParams() public void ryNoParams() {
{
System.out.println("执行无参方法"); System.out.println("执行无参方法");
} }
/**
* 住宅销售挂牌案例
*/
public void downloadResidenceOpeningCase() {
downloadOriginalResidenceSaleOpeningCaseService.download();
}
/**
* 下载第一批一手房成交案例
*/
public void downloadFirstNewHouseCase() {
}
/**
* 下载住宅销售二手房成交案例
*/
public void downloadResidenceClosingCase() {
downloadOriginalResidenceSaleClosingCaseService.download();
}
/**
* 下载第二批一手房成交案例
*/
public void downloadSecondNewHouseCase() {
}
} }

View File

@ -37,6 +37,8 @@ public class OriginalResidenceSaleClosingCase {
shangye.add("商店"); shangye.add("商店");
} }
private Integer yearMonth;
/** /**
* 唯一标识 * 唯一标识
*/ */
@ -264,14 +266,14 @@ public class OriginalResidenceSaleClosingCase {
*/ */
private BigDecimal refUnitPrice; private BigDecimal refUnitPrice;
public String getCaseId() {
return caseId;
}
public void setCaseId(String caseId) { public void setCaseId(String caseId) {
this.caseId = caseId; this.caseId = caseId;
} }
public String getCaseId() {
return caseId;
}
public String getCaseCommunityName() { public String getCaseCommunityName() {
return caseCommunityName; return caseCommunityName;
} }
@ -736,6 +738,14 @@ public class OriginalResidenceSaleClosingCase {
this.cleanCurrentFloorDesc = cleanCurrentFloorDesc; this.cleanCurrentFloorDesc = cleanCurrentFloorDesc;
} }
public Integer getYearMonth() {
return yearMonth;
}
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
}
/** /**
* 构造caseId * 构造caseId
* *
@ -743,9 +753,10 @@ public class OriginalResidenceSaleClosingCase {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
public String generateCaseId() { public String generateCaseId() {
String text = getCaseCountyName() + getCaseAddress() + getCaseArea(); String text = getCaseCountyName() + getCaseAddress();
if (null != getCaseSigningDate()) if (null != getCaseSigningDate()) {
text += simplaDateFormat.format(getCaseSigningDate()); text += simplaDateFormat.format(getCaseSigningDate());
}
return DigestUtils.md5DigestAsHex(text.getBytes()); return DigestUtils.md5DigestAsHex(text.getBytes());
} }
@ -777,17 +788,23 @@ public class OriginalResidenceSaleClosingCase {
* @return * @return
*/ */
public Integer refineCurrentFloor() { public Integer refineCurrentFloor() {
if (StringUtils.isEmpty(getCaseAddress())) return null; if (StringUtils.isEmpty(getCaseAddress())) {
return null;
}
Pattern pattern = Pattern.compile("(\\d+)(室)$"); Pattern pattern = Pattern.compile("(\\d+)(室)$");
Matcher matcher = pattern.matcher(getCaseAddress()); Matcher matcher = pattern.matcher(getCaseAddress());
if (!matcher.find()) return null; if (!matcher.find()) {
return null;
}
String value = matcher.group(1); String value = matcher.group(1);
Integer num = new Integer(value); Integer num = new Integer(value);
if (num > 1000 || num > 100) if (num > 1000 || num > 100) {
return num / 100; return num / 100;
}
return null; return null;
} }
@ -800,7 +817,9 @@ public class OriginalResidenceSaleClosingCase {
* @return * @return
*/ */
public String refineBuildingAddress() { public String refineBuildingAddress() {
if (StringUtils.isEmpty(getCaseAddress())) return null; if (StringUtils.isEmpty(getCaseAddress())) {
return null;
}
Pattern pattern = Pattern.compile("(\\d+)室$"); Pattern pattern = Pattern.compile("(\\d+)室$");
Matcher matcher = pattern.matcher(getCaseAddress()); Matcher matcher = pattern.matcher(getCaseAddress());

View File

@ -1,32 +1,41 @@
package com.ruoyi.project.data.cases.mapper; package com.ruoyi.project.data.cases.mapper;
import com.baomidou.dynamic.datasource.annotation.DS; 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.OriginalResidenceSaleOpeningCase;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel; import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/**
* 住宅住宅销售成交案例DAO
*
* @author lihe
* @date 2020年7月10日
*/
@DS("compute") @DS("compute")
public interface OriginalResidenceSaleClosingCaseMapper { public interface OriginalResidenceSaleClosingCaseMapper {
/** /**
* 创建表 * 创建住宅销售成交案例
* *
* @param yearMonth * @param yearMonth
* @return * @return
*/ */
int createTable(@Param("yearMonth") Integer yearMonth); int createRawTable(@Param("yearMonth") Integer yearMonth);
/** /**
* 原始成交案例 * 插入住宅销售成交案例
* @param yearMonth *
* @param originalResidenceSaleClosingCase
* @return * @return
*/ */
int createClosingCaseRawTable(@Param("yearMonth") Integer yearMonth); int insertRawTable(OriginalResidenceSaleClosingCase originalResidenceSaleClosingCase);
/** /**
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM * 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
*
* @param yearMonth * @param yearMonth
* @return * @return
*/ */

View File

@ -7,6 +7,11 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/**
* 住宅销售挂牌案例DAO
*
* @author lihe
*/
@DS("compute") @DS("compute")
public interface OriginalResidenceSaleOpeningCaseMapper { public interface OriginalResidenceSaleOpeningCaseMapper {
@ -16,16 +21,15 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
* @param yearMonth * @param yearMonth
* @return * @return
*/ */
int createTable(@Param("yearMonth") Integer yearMonth); int createRawTable(@Param("yearMonth") Integer yearMonth);
/** /**
* 插入住宅销售挂牌案例
* *
* @param yearMonth * @param originalResidenceSaleOpeningCase
* @return * @return
*/ */
int createOpeningCaseRawTable(@Param("yearMonth") Integer yearMonth); int insertRawTable(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
/** /**
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM * 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
@ -42,8 +46,10 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
* @return * @return
*/ */
int createAssembleTable(@Param("yearMonth") Integer yearMonth); int createAssembleTable(@Param("yearMonth") Integer yearMonth);
/** /**
* 作价表 * 作价表
*
* @param yearMonth * @param yearMonth
* @return * @return
*/ */
@ -51,6 +57,7 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
/** /**
* 人工修正价格表 * 人工修正价格表
*
* @param yearMonth * @param yearMonth
* @return * @return
*/ */
@ -73,6 +80,8 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase); Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
/** /**
* 分页列表
*
* @param queryModel * @param queryModel
* @return * @return
*/ */

View File

@ -6,10 +6,19 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/**
* 下载住宅销售成交案例
*
* @author lihe
* @date 2020年7月10日
*/
@DS("calc") @DS("calc")
public interface DownloadOriginalResidenceSaleClosingCaseMapper { public interface DownloadOriginalResidenceSaleClosingCaseMapper {
/** /**
* 获取住宅销售成交案例
*
* @param yearMonth
* @return * @return
*/ */
List<OriginalResidenceSaleClosingCase> download(@Param("yearMonth") Integer yearMonth); List<OriginalResidenceSaleClosingCase> download(@Param("yearMonth") Integer yearMonth);

View File

@ -5,10 +5,17 @@ import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import java.util.List; import java.util.List;
/**
* 外网住住宅销售挂牌案例
*
* @author lihe
*/
@DS("oldProd") @DS("oldProd")
public interface DownloadOriginalResidenceSaleOpeningCaseMapper { public interface DownloadOriginalResidenceSaleOpeningCaseMapper {
/** /**
* 获取最新的住宅销售挂牌案例列表
*
* @return * @return
*/ */
List<OriginalResidenceSaleOpeningCase> download(); List<OriginalResidenceSaleOpeningCase> download();

View File

@ -4,20 +4,26 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/**
* 推送住宅销售挂牌案例DAO
* @author lihe
*/
@DS("calc") @DS("calc")
public interface SyncOriginalResidenceSaleOpeningCaseMapper { public interface SyncOriginalResidenceSaleOpeningCaseMapper {
/** /**
* 创建挂牌案例表 * 创建挂牌案例表
*
* @param yearMonth * @param yearMonth
* @return
*/ */
int createTable(@Param("yearMonth") Integer yearMonth); int createRawTable(@Param("yearMonth") Integer yearMonth);
/** /**
* * 插入挂牌案例表
* @param originalResidenceSaleOpeningCase * @param originalResidenceSaleOpeningCase
* @return * @return
*/ */
int insert(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase); int insertRawTable(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
} }

View File

@ -1,5 +1,14 @@
package com.ruoyi.project.data.cases.service; package com.ruoyi.project.data.cases.service;
/**
* 住宅租赁案例SERVICE
*
* @author lihe
* @date 2020年7月10日
*/
public interface IOriginalResidenceRentOpeningCaseService { public interface IOriginalResidenceRentOpeningCaseService {
/**
* 挂牌案例数据下载
*/
void pullData(); void pullData();
} }

View File

@ -13,8 +13,6 @@ import org.springframework.stereotype.Service;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; 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 -> {
//
// });
// });
} }
} }

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -1,113 +1,113 @@
package com.ruoyi.project.data.cases.service.impl; //package com.ruoyi.project.data.cases.service.impl;
//
import com.baomidou.dynamic.datasource.annotation.DS; //import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.utils.LoadUtil; //import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase; //import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase;
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper; //import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleClosingCaseMapper; //import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleClosingCaseMapper;
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService; //import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; //import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; //import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource; //import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; //import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.util.Calendar; //import java.util.Calendar;
import java.util.Date; //import java.util.Date;
import java.util.List; //import java.util.List;
//
@Service //@Service
@DS("compute") //@DS("compute")
public class OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalResidenceSaleClosingCaseService { //public class OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalResidenceSaleClosingCaseService {
//
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleClosingCaseServiceImpl.class); // private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleClosingCaseServiceImpl.class);
//
@Autowired // @Autowired
private OriginalResidenceSaleClosingCaseMapper originalResidenceSaleClosingCaseMapper; // private OriginalResidenceSaleClosingCaseMapper originalResidenceSaleClosingCaseMapper;
@Autowired // @Autowired
private DownloadOriginalResidenceSaleClosingCaseMapper downloadOriginalResidenceSaleClosingCaseMapper; // private DownloadOriginalResidenceSaleClosingCaseMapper downloadOriginalResidenceSaleClosingCaseMapper;
@Autowired // @Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate; // private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired // @Autowired
private JdbcTemplate jdbcTemplate; // private JdbcTemplate jdbcTemplate;
//
/** // /**
* // *
*/ // */
@Scheduled(cron = "0 0 5 9 * ?") // @Scheduled(cron = "0 0 5 9 * ?")
@Override // @Override
public void clear() { // public void clear() {
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); // calendar.setTime(new Date());
Integer targetTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), // Integer targetTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH))); // calendar.get(Calendar.MONTH)));
calendar.add(Calendar.MONTH, 1); // calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), // Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1)); // calendar.get(Calendar.MONTH) + 1));
//
// targetTableRoute = 202005; //// targetTableRoute = 202005;
// computeTableRoute = 202007; //// computeTableRoute = 202007;
//
prepare(computeTableRoute); // prepare(computeTableRoute);
List<OriginalResidenceSaleClosingCase> list = // List<OriginalResidenceSaleClosingCase> list =
downloadOriginalResidenceSaleClosingCaseMapper.download(targetTableRoute); // downloadOriginalResidenceSaleClosingCaseMapper.download(targetTableRoute);
list.parallelStream().forEach(originalResidenceSaleClosingCase -> { // list.parallelStream().forEach(originalResidenceSaleClosingCase -> {
originalResidenceSaleClosingCase.setCaseId(originalResidenceSaleClosingCase.generateCaseId()); // originalResidenceSaleClosingCase.setCaseId(originalResidenceSaleClosingCase.generateCaseId());
originalResidenceSaleClosingCase.setCleanPropertyType(originalResidenceSaleClosingCase.refinePropertyType()); // originalResidenceSaleClosingCase.setCleanPropertyType(originalResidenceSaleClosingCase.refinePropertyType());
// originalResidenceSaleClosingCase.setCleanCurrentFloor(originalResidenceSaleClosingCase //// originalResidenceSaleClosingCase.setCleanCurrentFloor(originalResidenceSaleClosingCase
// .refineCurrentFloor()); //// .refineCurrentFloor());
// originalResidenceSaleClosingCase.setCleanBuildingAddress(originalResidenceSaleClosingCase //// originalResidenceSaleClosingCase.setCleanBuildingAddress(originalResidenceSaleClosingCase
// .refineBuildingAddress()); //// .refineBuildingAddress());
}); // });
running(computeTableRoute, list); // running(computeTableRoute, list);
after(computeTableRoute); // after(computeTableRoute);
} // }
//
/** // /**
* 准备工作 创建表 // * 准备工作 创建表
* // *
* @param computeTableRoute // * @param computeTableRoute
*/ // */
public void prepare(Integer computeTableRoute) { // public void prepare(Integer computeTableRoute) {
originalResidenceSaleClosingCaseMapper.createTable(computeTableRoute); // originalResidenceSaleClosingCaseMapper.createRawTable(computeTableRoute);
originalResidenceSaleClosingCaseMapper.createCleanTable(computeTableRoute); // originalResidenceSaleClosingCaseMapper.createCleanTable(computeTableRoute);
} // }
//
/** // /**
* 批量入库 // * 批量入库
* // *
* @param computeTableRoute // * @param computeTableRoute
* @param list // * @param list
*/ // */
public void running(Integer computeTableRoute, List<OriginalResidenceSaleClosingCase> list) { // public void running(Integer computeTableRoute, List<OriginalResidenceSaleClosingCase> list) {
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray()); // SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" + // int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
".original_residence_sale_closing_case_" + computeTableRoute + "(case_id,case_county_name," + // ".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_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_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_agency_name,case_agency_type,case_seller_type,case_buyer_type,case_birthday," +
"case_deal_type,clean_property_type,create_time) " + // "case_deal_type,clean_property_type,create_time) " +
"values (:caseId,:caseCountyName,:caseBlockName,:caseLoopName,:caseCommunityName," + // "values (:caseId,:caseCountyName,:caseBlockName,:caseLoopName,:caseCommunityName," +
":caseAddress,:caseArea,:caseUnitPrice,:caseTotalPrice,:caseHouseType,:caseSigningDate," + // ":caseAddress,:caseArea,:caseUnitPrice,:caseTotalPrice,:caseHouseType,:caseSigningDate," +
":caseRegisterDate,:agencyName,:agencyType,:sellerType,:buyerType,:birthday," + // ":caseRegisterDate,:agencyName,:agencyType,:sellerType,:buyerType,:birthday," +
":cleanCaseType,:cleanPropertyType,GETDATE());", // ":cleanCaseType,:cleanPropertyType,GETDATE());",
batchParams); // batchParams);
} // }
//
/** // /**
* 清洗成交数据 // * 清洗成交数据
* // *
* @param yearMonth // * @param yearMonth
*/ // */
public void after(Integer yearMonth) { // public void after(Integer yearMonth) {
// sql-template/.sql // // sql-template/.sql
// String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_closing_case.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 rawSql = LoadUtil.loadContent("sql-template/clear_sale_closing_case.sql");
String sql = rawSql.replace("#yearMonth#", yearMonth.toString()); // String sql = rawSql.replace("#yearMonth#", yearMonth.toString());
jdbcTemplate.update(sql); // jdbcTemplate.update(sql);
} // }
} //}

View File

@ -1,132 +1,132 @@
package com.ruoyi.project.data.cases.service.impl; //package com.ruoyi.project.data.cases.service.impl;
//
import com.baomidou.dynamic.datasource.annotation.DS; //import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.utils.LoadUtil; //import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; //import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper; //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.DownloadOriginalResidenceSaleOpeningCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper; //import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService; //import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; //import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; //import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource; //import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; //import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.util.Calendar; //import java.util.Calendar;
import java.util.Date; //import java.util.Date;
import java.util.List; //import java.util.List;
//
@Service //@Service
@DS("compute") //@DS("compute")
public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService { //public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService {
//
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class); // private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class);
//
@Autowired // @Autowired
private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper; // private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper;
@Autowired // @Autowired
private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper; // private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper;
@Autowired // @Autowired
private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper; // private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper;
@Autowired // @Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate; // private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired // @Autowired
private JdbcTemplate jdbcTemplate; // private JdbcTemplate jdbcTemplate;
//
/** // /**
* // *
*/ // */
@Scheduled(cron = "0 0 5 25 * ?") // @Scheduled(cron = "0 0 5 25 * ?")
@Override // @Override
public void clear() { // public void clear() {
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); // calendar.setTime(new Date());
Integer syncTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), // Integer syncTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH))); // calendar.get(Calendar.MONTH)));
Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), // Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1)); // calendar.get(Calendar.MONTH) + 1));
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1); // calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
Date valuePoint = calendar.getTime(); // Date valuePoint = calendar.getTime();
calendar.add(Calendar.MONTH, 1); // calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), // Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1)); // calendar.get(Calendar.MONTH) + 1));
// computeTableRoute = 202007; //// computeTableRoute = 202007;
// lastYearMonth = 202006; //// lastYearMonth = 202006;
//
prepare(computeTableRoute, syncTableRoute); // prepare(computeTableRoute, syncTableRoute);
List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download(); // List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download();
list.parallelStream().forEach(originalResidenceOpeningCase -> { // list.parallelStream().forEach(originalResidenceOpeningCase -> {
// originalResidenceOpeningCase.clear(); //// originalResidenceOpeningCase.clear();
// originalResidenceOpeningCase.setYearMonth(syncTableRoute); //// originalResidenceOpeningCase.setYearMonth(syncTableRoute);
// syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase); //// syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase);
}); // });
running(computeTableRoute, list); // running(computeTableRoute, list);
after(computeTableRoute, lastYearMonth); // after(computeTableRoute, lastYearMonth);
} // }
//
/** // /**
* 准备工作 创建表 // * 准备工作 创建表
* // *
* @param computeTableRoute // * @param computeTableRoute
* @param syncTableRoute // * @param syncTableRoute
*/ // */
public void prepare(Integer computeTableRoute, Integer syncTableRoute) { // public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
originalResidenceSaleOpeningCaseMapper.createOpeningCaseRawTable(computeTableRoute); // originalResidenceSaleOpeningCaseMapper.createRawTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute); // originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute); // originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute); // originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute); // originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createUltimatePriceTable(computeTableRoute); // originalResidenceSaleOpeningCaseMapper.createUltimatePriceTable(computeTableRoute);
// syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute); //// syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
} // }
//
/** // /**
* 批量入库 // * 批量入库
* // *
* @param computeTableRoute // * @param computeTableRoute
* @param list // * @param list
*/ // */
public void running(Integer computeTableRoute, List<OriginalResidenceSaleOpeningCase> list) { // public void running(Integer computeTableRoute, List<OriginalResidenceSaleOpeningCase> list) {
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray()); // SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" + // int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
".ODS_HOUSINGCASELISTED_LJ_" + computeTableRoute + "_RAW(case_id, llid, lcid, Name, " + // ".ODS_HOUSINGCASELISTED_LJ_" + computeTableRoute + "_RAW(case_id, llid, lcid, Name, " +
"Roomtype, Area, Towards, Storey, Lastdeal, Condoelev, Decoration, Year, Address, Price, " + // "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) " + // "Cname, Visited_Num, First_Visit_Time, Visited_Num_15, Visited_Num_30, Url, Curl, CurlDate) " +
"values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," + // "values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," +
":caseApartmentLayout,:caseArea,:caseToward,:caseStorey,:caseLastDeal,:caseElevator" + // ":caseApartmentLayout,:caseArea,:caseToward,:caseStorey,:caseLastDeal,:caseElevator" +
",:caseDecoration,:caseYear,:caseAddress,:casePrice,:caseCommunityName,:caseVisitedNum," + // ",:caseDecoration,:caseYear,:caseAddress,:casePrice,:caseCommunityName,:caseVisitedNum," +
":caseFirstVisitTime,:caseVisitedNum15,:caseVisitedNum30,:caseUrl,:caseCommunityUrl," + // ":caseFirstVisitTime,:caseVisitedNum15,:caseVisitedNum30,:caseUrl,:caseCommunityUrl," +
":caseGetDate);", // ":caseGetDate);",
batchParams); // batchParams);
} // }
//
/** // /**
* 匹配数据 // * 匹配数据
* 计算基价 // * 计算基价
* // *
* @param yearMonth // * @param yearMonth
* @param lastYearMonth // * @param lastYearMonth
*/ // */
public void after(Integer yearMonth, Integer 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_sale_opening_case.sql");
// String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_opening_case.sql"); //// String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_opening_case.sql");
String sql = rawSql.replace("#yearMonth#", yearMonth.toString()) // String sql = rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString()); // .replace("#lastYearMonth#", lastYearMonth.toString());
jdbcTemplate.update(sql); // jdbcTemplate.update(sql);
//
// 作价 // // 作价
rawSql = LoadUtil.loadContent("sql-template/compute_sale_price.sql"); // rawSql = LoadUtil.loadContent("sql-template/compute_sale_price.sql");
sql = rawSql.replace("#yearMonth#", yearMonth.toString()) // sql = rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString()); // .replace("#lastYearMonth#", lastYearMonth.toString());
jdbcTemplate.update(sql); // jdbcTemplate.update(sql);
//
logger.debug("#作价完成#"); // logger.debug("#作价完成#");
} // }
} //}

View File

@ -4,42 +4,41 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper"> <mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper">
<update id="createRawClosingCaseTable"> <!-- <update id="createRawClosingCaseTable">-->
<bind name="targetTableName" value="'dbo.二手房成交数据' + yearMonth" /> <!-- <bind name="targetTableName" value="'dbo.二手房成交数据' + yearMonth" />-->
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL <!-- IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL-->
drop table ${targetTableName}; <!-- drop table ${targetTableName};-->
create table ${targetTableName} <!-- create table ${targetTableName}-->
( <!-- (-->
case_id uniqueidentifier not null primary key, <!-- case_id uniqueidentifier not null primary key,-->
区域 varchar (255) NULL, <!-- 区域 varchar (255) NULL,-->
板块 varchar (255) NULL, <!-- 板块 varchar (255) NULL,-->
环线 varchar (255) NULL, <!-- 环线 varchar (255) NULL,-->
小区名称 varchar (255) NULL, <!-- 小区名称 varchar (255) NULL,-->
房屋地址 varchar (255) NULL, <!-- 房屋地址 varchar (255) NULL,-->
面积 float NULL, <!-- 面积 float NULL,-->
房屋类型 varchar (255) NULL, <!-- 房屋类型 varchar (255) NULL,-->
总价 float NULL, <!-- 总价 float NULL,-->
单价 float NULL, <!-- 单价 float NULL,-->
登记日期 varchar (255) NULL, <!-- 登记日期 varchar (255) NULL,-->
签约日期 varchar (255) NULL, <!-- 签约日期 varchar (255) NULL,-->
中介公司 varchar (255) NULL, <!-- 中介公司 varchar (255) NULL,-->
中介类型 varchar (255) NULL, <!-- 中介类型 varchar (255) NULL,-->
卖家类型 float NULL, <!-- 卖家类型 float NULL,-->
买家类型 varchar (5) NULL, <!-- 买家类型 varchar (5) NULL,-->
出生年月日 varchar (5) NULL <!-- 出生年月日 varchar (5) NULL-->
) <!-- )-->
</update> <!-- </update>-->
<!-- 外部数据重复问题 --> <!-- 外部数据重复问题 -->
<update id="createTable"> <update id="createRawTable">
<bind name="targetTableName" value="'dbo.original_residence_sale_closing_case_' + yearMonth"/> <bind name="targetTableName" value="'dbo.original_residence_sale_closing_case_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName}; drop table ${targetTableName};
CREATE TABLE ${targetTableName} CREATE TABLE ${targetTableName}
( (
id int identity(1,1) not null,
case_id varchar(32) not null, case_id varchar(32) not null,
case_county_name nvarchar(20) null, case_county_name nvarchar(20) null,
case_block_name nvarchar(20) null, case_block_name nvarchar(20) null,
@ -99,4 +98,52 @@
DateContract date NULL DateContract date NULL
); );
</update> </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> </mapper>

View File

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper"> <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'"/> <bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth +'_RAW'"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName}; drop table ${targetTableName};
@ -35,70 +35,70 @@
, CurlDate date , CurlDate date
); );
</update> </update>
<!--过时--> <!--原始数据-->
<update id="createTable"> <!-- <update id="createRawTable">-->
<bind name="targetTableName" value="'dbo.original_residence_sale_opening_case_' + yearMonth"/> <!-- <bind name="targetTableName" value="'dbo.original_residence_sale_opening_case_' + yearMonth"/>-->
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL <!-- IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL-->
drop table ${targetTableName}; <!-- drop table ${targetTableName};-->
CREATE TABLE ${targetTableName} <!-- CREATE TABLE ${targetTableName}-->
( <!-- (-->
case_id varchar (32) NOT NULL, <!-- case_id varchar (32) NOT NULL,-->
case_lianjia_id nvarchar (50) NOT null primary key, <!-- case_lianjia_id nvarchar (50) NOT null primary key,-->
case_lianjia_community_id nvarchar (50) NOT NULL, <!-- case_lianjia_community_id nvarchar (50) NOT NULL,-->
case_title nvarchar (500) NOT NULL, <!-- case_title nvarchar (500) NOT NULL,-->
clean_property_type nvarchar (20) NULL, <!-- clean_property_type nvarchar (20) NULL,-->
case_apartment_layout nvarchar (500) NOT NULL, <!-- case_apartment_layout nvarchar (500) NOT NULL,-->
case_house_structure nvarchar (50) NULL, <!-- case_house_structure nvarchar (50) NULL,-->
case_area decimal (10, 2) NOT NULL, <!-- case_area decimal (10, 2) NOT NULL,-->
case_underground_area decimal (10, 2) NULL, <!-- case_underground_area decimal (10, 2) NULL,-->
case_toward nvarchar (50) NOT NULL, <!-- case_toward nvarchar (50) NOT NULL,-->
clean_toward nvarchar (50) NULL, <!-- clean_toward nvarchar (50) NULL,-->
case_storey nvarchar (20) NOT NULL, <!-- case_storey nvarchar (20) NOT NULL,-->
clean_total_floor int NOT NULL, <!-- clean_total_floor int NOT NULL,-->
clean_current_floor_desc nvarchar (20) NULL, <!-- clean_current_floor_desc nvarchar (20) NULL,-->
case_elevator nvarchar (20) NULL, <!-- case_elevator nvarchar (20) NULL,-->
clean_elevator nvarchar (20) NULL, <!-- clean_elevator nvarchar (20) NULL,-->
case_tihu nvarchar (20) NULL, <!-- case_tihu nvarchar (20) NULL,-->
case_decoration nvarchar (20) NULL, <!-- case_decoration nvarchar (20) NULL,-->
clean_decoration nvarchar (50) NULL, <!-- clean_decoration nvarchar (50) NULL,-->
case_year int NOT NULL, <!-- case_year int NOT NULL,-->
clean_year int NOT NULL, <!-- clean_year int NOT NULL,-->
case_address nvarchar (500) NULL, <!-- case_address nvarchar (500) NULL,-->
case_vid nvarchar (500) NULL, <!-- case_vid nvarchar (500) NULL,-->
case_chan_quan_xing_zhi nvarchar (200) NULL, <!-- case_chan_quan_xing_zhi nvarchar (200) NULL,-->
case_price decimal (18, 2) NOT NULL, <!-- case_price decimal (18, 2) NOT NULL,-->
clean_unit_price decimal (18, 2) NOT NULL, <!-- clean_unit_price decimal (18, 2) NOT NULL,-->
clean_total_price decimal (18, 2) NOT NULL, <!-- clean_total_price decimal (18, 2) NOT NULL,-->
case_community_name nvarchar (500) NULL, <!-- case_community_name nvarchar (500) NULL,-->
case_visited_num int NOT NULL, <!-- case_visited_num int NOT NULL,-->
case_visited_num_15 int NOT NULL, <!-- case_visited_num_15 int NOT NULL,-->
case_visited_num_30 int NOT NULL, <!-- case_visited_num_30 int NOT NULL,-->
case_latest_deal_date date NULL, <!-- case_latest_deal_date date NULL,-->
case_latest_visited_date date NULL, <!-- case_latest_visited_date date NULL,-->
case_first_visited_date date NULL, <!-- case_first_visited_date date NULL,-->
case_url nvarchar (500) NOT NULL, <!-- case_url nvarchar (500) NOT NULL,-->
case_community_url nvarchar (500) NOT NULL, <!-- case_community_url nvarchar (500) NOT NULL,-->
case_get_date date NOT NULL, <!-- case_get_date date NOT NULL,-->
case_provider nvarchar (50) NOT NULL, <!-- case_provider nvarchar (50) NOT NULL,-->
uv_community_name nvarchar (500) NULL, <!-- uv_community_name nvarchar (500) NULL,-->
uv_community_address nvarchar (1024) NULL, <!-- uv_community_address nvarchar (1024) NULL,-->
uv_community_id nvarchar (20) NULL, <!-- uv_community_id nvarchar (20) NULL,-->
uv_building_id nvarchar (20) NULL, <!-- uv_building_id nvarchar (20) NULL,-->
uv_county nvarchar (50) NULL, <!-- uv_county nvarchar (50) NULL,-->
uv_block nvarchar (50) NULL, <!-- uv_block nvarchar (50) NULL,-->
uv_loop nvarchar (50) NULL, <!-- uv_loop nvarchar (50) NULL,-->
area_coefficient decimal (18, 6) NULL, <!-- area_coefficient decimal (18, 6) NULL,-->
toward_coefficient decimal (18, 6) NULL, <!-- toward_coefficient decimal (18, 6) NULL,-->
floor_coefficient decimal (18, 6) NULL, <!-- floor_coefficient decimal (18, 6) NULL,-->
decoration_coefficient int NULL, <!-- decoration_coefficient int NULL,-->
year_coefficient decimal (18, 6) NULL, <!-- year_coefficient decimal (18, 6) NULL,-->
building_coefficient decimal (18, 6) NULL, <!-- building_coefficient decimal (18, 6) NULL,-->
adjust_unit_price decimal (18, 2) NULL, <!-- adjust_unit_price decimal (18, 2) NULL,-->
clean_project_level nvarchar (50) NULL, <!-- clean_project_level nvarchar (50) NULL,-->
create_time datetime NOT NULL <!-- create_time datetime NOT NULL-->
); <!-- );-->
</update> <!-- </update>-->
<!--清洗表--> <!--清洗表-->
<update id="createCleanTable"> <update id="createCleanTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth"/> <bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth"/>

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper"> <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'"/> <bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth + '_RAW'"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NULL IF OBJECT_ID(#{targetTableName}, 'U') IS NULL
CREATE TABLE ${targetTableName} CREATE TABLE ${targetTableName}
@ -35,7 +35,7 @@
truncate table ${targetTableName} truncate table ${targetTableName}
</update> </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 insert into dbo.ODS_HOUSINGCASELISTED_LJ_${yearMonth}_RAW
( (
llid llid

View File

@ -1,5 +1,7 @@
----#HousingCaseListAdj 插入挂牌清洗数据 truncate table Ods_HousingCaseListed_LJ_#yearMonth#
------ 20200312BUG修复朝向处理规则优化
--#HousingCaseListAdj 插入挂牌清洗数据
-- 20200312BUG修复朝向处理规则优化
create table #HousingCaseListAdj create table #HousingCaseListAdj
( (
case_id varchar(32) not null case_id varchar(32) not null
@ -97,7 +99,7 @@ DEALLOCATE Record2Insert
SET NOCOUNT OFF SET NOCOUNT OFF
---- --
create table #HousingCaseListSTD create table #HousingCaseListSTD
( (
HouseholdsID_LJ bigint HouseholdsID_LJ bigint
@ -122,24 +124,24 @@ SELECT A.HouseholdsID_LJ, A.ProjectID_LJ, B.ProjectID, B.BuildingID,
FROM #HousingCaseListAdj A FROM #HousingCaseListAdj A
LEFT JOIN obpm_LianCheng_Data.dbo.DIM_PROJECTID_LJ2AI B LEFT JOIN obpm_LianCheng_Data.dbo.DIM_PROJECTID_LJ2AI B
ON A.ProjectID_LJ = B.ProjectID_LJ 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 left join (select CommunityId,ProjectLevel from uv_compute.dbo.ResidenceCommunity) C
on B.ProjectID = C.ProjectID on B.ProjectID = C.CommunityId
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='面积修正(链家挂牌)') D -- LEFT JOIN (SELECT ProjectLevel,LowerKey,UpperKey,CoefficientA,CoefficientB FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='面积修正(链家挂牌)' and ProjectType = '公寓') D --
on D.ProjectType = '公寓' and C.ProjectLevel = D.ProjectLevel and ( A.Area > D.LowerKey and A.Area <= D.UpperKey) on 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 -- LEFT JOIN (SELECT SingleKey,Coefficient FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='朝向(链家挂牌)' and ProjectType = '公寓') E --
on E.ProjectType = '公寓' and A.Towards = E.SingleKey on A.Towards = E.SingleKey
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='楼层(链家挂牌)') F -- LEFT JOIN (SELECT Elevator,UpperKey,LowerKey,Coefficient FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='楼层(链家挂牌)' and ProjectType = '公寓') F --
on F.ProjectType = '公寓' and isnull(A.Elevator,99)=isnull(F.Elevator,99) and A.UpperFloorSum = F.UpperKey and A.UpperFloorNum = F.LowerKey on 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 -- LEFT JOIN (SELECT SingleKey,Coefficient FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='室内装修(链家挂牌)' and ProjectType = '公寓') G --
on G.ProjectType = '公寓' and A.Decoration = G.SingleKey on A.Decoration = G.SingleKey
LEFT JOIN (SELECT * FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='竣工日期') H -- LEFT JOIN (SELECT SingleKey,Coefficient FROM obpm_LianCheng_Data.dbo.DIM_PARAMETERS WHERE CoffType='竣工日期' and ProjectType = '公寓') H --
on H.ProjectType = '公寓' and A.[Year]=H.SingleKey on A.[Year]=H.SingleKey
LEFT JOIN obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF I LEFT JOIN obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF I
on B.BuildingID = I.BuildingID; on B.BuildingID = I.BuildingID;
-- --
--- 20200205BUG修复AdjustedValue、AdjustedPst 中当Status=1时值不为0的问题 -- 20200205BUG修复AdjustedValue、AdjustedPst 中当Status=1时值不为0的问题
select select
a.HouseholdsID_LJ, a.HouseholdsID_LJ,
case when b.Status is null then 3 case when b.Status is null then 3
@ -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], 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.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, a.Visited_Num, a.First_Visit_Time, a.Visited_Num_15, a.Visited_Num_30, 5 as Status,

View File

@ -1,10 +1,7 @@
package com.ruoyi; package com.ruoyi;
import com.ruoyi.project.data.cases.domain.CleanResidenceRentAggregationCase; import com.ruoyi.project.data.cases.domain.*;
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.price.domain.ComputeResidenceSaleBasePrice; import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice; import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
import org.junit.Assert; import org.junit.Assert;
@ -96,7 +93,7 @@ public class GenerateTableTests {
@Test @Test
public void generateBatchGuoHaoInsertSqL() { public void generateBatchGuoHaoInsertSqL() {
Class targetClass = OriginalNewHouseCase.class; Class targetClass = OriginalResidenceSaleClosingCase .class;
List<Field> fieldList = new ArrayList<>(); List<Field> fieldList = new ArrayList<>();
while (targetClass != null) { while (targetClass != null) {
@ -135,6 +132,21 @@ public class GenerateTableTests {
Assert.assertEquals("4868c51874ba68c7fa2c96eeac02cde7",originalNewHouseCase.getCaseId()); 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层';");
}
}
} }

View File

@ -61,6 +61,11 @@ public class DownloadOriginalNewHouseCaseServiceImplTests {
downloadOriginalNewHouseCaseService.downloadFirst(201901); downloadOriginalNewHouseCaseService.downloadFirst(201901);
} }
@Test
public void testDownload202003First() {
downloadOriginalNewHouseCaseService.downloadFirst(202003);
}
@Test @Test
public void testDownloadLastYearSecondLoop() { public void testDownloadLastYearSecondLoop() {
Arrays.asList(201901, 201902, 201903, 201904, 201905, 201906, 201907, 201908, 201909, 201910, 201911, 201912).parallelStream().forEach(i -> { Arrays.asList(201901, 201902, 201903, 201904, 201905, 201906, 201907, 201908, 201909, 201910, 201911, 201912).parallelStream().forEach(i -> {

View File

@ -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);
}
}