feature (住宅销售作价): 实现定时住宅销售基价作价
1. 住宅销售成交案例 2. 住宅销售挂牌案例 3. 案例清洗 4. 作价
This commit is contained in:
@ -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;
|
||||||
|
@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
@ -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);
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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 -> {
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
//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);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -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("#作价完成#");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -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>
|
@ -4,146 +4,146 @@
|
|||||||
"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};
|
||||||
|
|
||||||
create table ${targetTableName}
|
create table ${targetTableName}
|
||||||
(
|
(
|
||||||
case_id varchar (32) not null primary key
|
case_id varchar (32) not null primary key
|
||||||
, llid bigint
|
, llid bigint
|
||||||
, lcid bigint
|
, lcid bigint
|
||||||
, Name sql_variant
|
, Name sql_variant
|
||||||
, Roomtype nvarchar(50)
|
, Roomtype nvarchar(50)
|
||||||
, Area decimal(18, 2)
|
, Area decimal(18, 2)
|
||||||
, Towards nvarchar(50)
|
, Towards nvarchar(50)
|
||||||
, Storey nvarchar(50)
|
, Storey nvarchar(50)
|
||||||
, Lastdeal date
|
, Lastdeal date
|
||||||
, Condoelev nvarchar(50)
|
, Condoelev nvarchar(50)
|
||||||
, Decoration nvarchar(50)
|
, Decoration nvarchar(50)
|
||||||
, Year int
|
, Year int
|
||||||
, Address nvarchar(1024)
|
, Address nvarchar(1024)
|
||||||
, Price decimal(18, 2)
|
, Price decimal(18, 2)
|
||||||
, Cname nvarchar(1024)
|
, Cname nvarchar(1024)
|
||||||
, Visited_Num int
|
, Visited_Num int
|
||||||
, First_Visit_Time date
|
, First_Visit_Time date
|
||||||
, Visited_Num_15 int
|
, Visited_Num_15 int
|
||||||
, Visited_Num_30 int
|
, Visited_Num_30 int
|
||||||
, Url nvarchar(512)
|
, Url nvarchar(512)
|
||||||
, Curl nvarchar(512)
|
, Curl nvarchar(512)
|
||||||
, 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"/>
|
||||||
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,
|
||||||
HouseholdsID_LJ bigint not null primary key,
|
HouseholdsID_LJ bigint not null primary key,
|
||||||
ProjectID_LJ bigint null,
|
ProjectID_LJ bigint null,
|
||||||
ProjectID bigint null,
|
ProjectID bigint null,
|
||||||
Roomtype nvarchar(64) null,
|
Roomtype nvarchar(64) null,
|
||||||
Area decimal(18, 2) null,
|
Area decimal(18, 2) null,
|
||||||
Towards nvarchar(64) null,
|
Towards nvarchar(64) null,
|
||||||
UpperFloorSum nvarchar(32) null,
|
UpperFloorSum nvarchar(32) null,
|
||||||
UpperFloorNum nvarchar(32) null,
|
UpperFloorNum nvarchar(32) null,
|
||||||
Elevator tinyint null,
|
Elevator tinyint null,
|
||||||
Decoration nvarchar(64) null,
|
Decoration nvarchar(64) null,
|
||||||
Year int null,
|
Year int null,
|
||||||
AreaCoff decimal(7, 4) null,
|
AreaCoff decimal(7, 4) null,
|
||||||
TowardsCoff decimal(7, 4) null,
|
TowardsCoff decimal(7, 4) null,
|
||||||
FloorCoff decimal(7, 4) null,
|
FloorCoff decimal(7, 4) null,
|
||||||
DecorationRng int null,
|
DecorationRng int null,
|
||||||
YearCoff decimal(7, 4) null,
|
YearCoff decimal(7, 4) null,
|
||||||
BuildingCoff decimal(7, 4) null,
|
BuildingCoff decimal(7, 4) null,
|
||||||
PriceTotal decimal(18, 2) null,
|
PriceTotal decimal(18, 2) null,
|
||||||
PriceUnit decimal(18, 2) not null,
|
PriceUnit decimal(18, 2) not null,
|
||||||
PriceUnitAdj decimal(18, 2) not null,
|
PriceUnitAdj decimal(18, 2) not null,
|
||||||
Visited_Num int null,
|
Visited_Num int null,
|
||||||
First_Visit_Time date null,
|
First_Visit_Time date null,
|
||||||
Visited_Num_15 int null,
|
Visited_Num_15 int null,
|
||||||
Visited_Num_30 int null,
|
Visited_Num_30 int null,
|
||||||
Status tinyint null,
|
Status tinyint null,
|
||||||
AdjustedValue decimal(18, 2) null,
|
AdjustedValue decimal(18, 2) null,
|
||||||
AdjustedPst decimal(18, 6) null,
|
AdjustedPst decimal(18, 6) null,
|
||||||
AdjustedCumValue decimal(18, 2) null,
|
AdjustedCumValue decimal(18, 2) null,
|
||||||
AdjustedCumPst decimal(18, 6) null,
|
AdjustedCumPst decimal(18, 6) null,
|
||||||
AdjustedCumValueAbs decimal(18, 2) null,
|
AdjustedCumValueAbs decimal(18, 2) null,
|
||||||
AdjustedCumPstAbs decimal(18, 6) null,
|
AdjustedCumPstAbs decimal(18, 6) null,
|
||||||
AdjustedCumNum int null,
|
AdjustedCumNum int null,
|
||||||
PriceTotalIn decimal(18, 2) null,
|
PriceTotalIn decimal(18, 2) null,
|
||||||
PriceTotalOut decimal(18, 2) null,
|
PriceTotalOut decimal(18, 2) null,
|
||||||
PriceDateIn date null,
|
PriceDateIn date null,
|
||||||
PriceDateOut date null
|
PriceDateOut date null
|
||||||
);
|
);
|
||||||
</update>
|
</update>
|
||||||
<!-- 案例汇总表 -->
|
<!-- 案例汇总表 -->
|
||||||
|
@ -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
|
||||||
|
@ -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,58 +124,58 @@ 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
|
||||||
when a.PriceTotal=b.PriceTotal then 1
|
when a.PriceTotal=b.PriceTotal then 1
|
||||||
else 2 end as Status,
|
else 2 end as Status,
|
||||||
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
|
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else a.PriceTotal-b.PriceTotal end AdjustedValue,
|
else a.PriceTotal-b.PriceTotal end AdjustedValue,
|
||||||
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
|
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else (a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotal end AdjustedPst,
|
else (a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotal end AdjustedPst,
|
||||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValue
|
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValue
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else b.AdjustedCumValue + a.PriceTotal-b.PriceTotal end AdjustedCumValue,
|
else b.AdjustedCumValue + a.PriceTotal-b.PriceTotal end AdjustedCumValue,
|
||||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPst
|
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPst
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else (b.AdjustedCumValue + a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotalIn end AdjustedCumPst,
|
else (b.AdjustedCumValue + a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotalIn end AdjustedCumPst,
|
||||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValueAbs
|
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValueAbs
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else b.AdjustedCumValueAbs + abs(a.PriceTotal-b.PriceTotal) end AdjustedCumValueAbs,
|
else b.AdjustedCumValueAbs + abs(a.PriceTotal-b.PriceTotal) end AdjustedCumValueAbs,
|
||||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
|
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else (b.AdjustedCumValueAbs+ abs(a.PriceTotal-b.PriceTotal))*1.0/b.PriceTotalIn end AdjustedCumPstAbs,
|
else (b.AdjustedCumValueAbs+ abs(a.PriceTotal-b.PriceTotal))*1.0/b.PriceTotalIn end AdjustedCumPstAbs,
|
||||||
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
|
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
|
||||||
when b.Status is null then 0
|
when b.Status is null then 0
|
||||||
else b.AdjustedCumNum+1 end AdjustedCumNum,
|
else b.AdjustedCumNum+1 end AdjustedCumNum,
|
||||||
case when b.Status is null then a.PriceTotal else b.PriceTotalIn end PriceTotalIn,
|
case when b.Status is null then a.PriceTotal else b.PriceTotalIn end PriceTotalIn,
|
||||||
NULL as PriceTotalOut,
|
NULL as PriceTotalOut,
|
||||||
case when b.Status is null then getdate() else b.PriceDateIn end PriceDateIn,
|
case when b.Status is null then getdate() else b.PriceDateIn end PriceDateIn,
|
||||||
cast(NULL as date) as PriceDateOut
|
cast(NULL as date) as PriceDateOut
|
||||||
into #HousingCaseListStatic
|
into #HousingCaseListStatic
|
||||||
from #HousingCaseListAdj a
|
from #HousingCaseListAdj a
|
||||||
left join Ods_HousingCaseListed_LJ_#lastYearMonth# b
|
left join Ods_HousingCaseListed_LJ_#lastYearMonth# b
|
||||||
on a.HouseholdsID_LJ = b.HouseholdsID_LJ;
|
on a.HouseholdsID_LJ = b.HouseholdsID_LJ;
|
||||||
|
|
||||||
--插入当月未下架(活跃)案例数据
|
--插入当月未下架(活跃)案例数据
|
||||||
insert into Ods_HousingCaseListed_LJ_#yearMonth#
|
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],
|
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,
|
||||||
|
@ -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层';");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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 -> {
|
||||||
|
@ -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