feature (一手成交案例下载):定时下载一手成交案例数据
1. 第一批 2. 第二批 3. 分表存储,未同步更新;
This commit is contained in:
parent
462207c613
commit
198628a6a6
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.framework.task;
|
||||
|
||||
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentOpeningCaseService;
|
||||
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalNewHouseCaseServiceImpl;
|
||||
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalResidenceSaleClosingCaseServiceImpl;
|
||||
import com.ruoyi.project.data.cases.service.impl.DownloadOriginalResidenceSaleOpeningCaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -19,6 +20,8 @@ public class RyTask {
|
||||
private DownloadOriginalResidenceSaleOpeningCaseServiceImpl downloadOriginalResidenceSaleOpeningCaseService;
|
||||
@Autowired
|
||||
private DownloadOriginalResidenceSaleClosingCaseServiceImpl downloadOriginalResidenceSaleClosingCaseService;
|
||||
@Autowired
|
||||
private DownloadOriginalNewHouseCaseServiceImpl downloadOriginalNewHouseCaseService;
|
||||
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
|
||||
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
|
||||
@ -43,7 +46,7 @@ public class RyTask {
|
||||
* 下载第一批一手房成交案例
|
||||
*/
|
||||
public void downloadFirstNewHouseCase() {
|
||||
|
||||
downloadOriginalNewHouseCaseService.downloadFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +60,7 @@ public class RyTask {
|
||||
* 下载第二批一手房成交案例
|
||||
*/
|
||||
public void downloadSecondNewHouseCase() {
|
||||
|
||||
downloadOriginalNewHouseCaseService.downloadSecond();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
package com.ruoyi.project.data.cases.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.common.constant.LabelConstants;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.project.data.cases.domain.OriginalNewHouseCase;
|
||||
import com.ruoyi.project.data.cases.mapper.OriginalNewHouseCaseMapper;
|
||||
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalNewHouseCaseMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -21,6 +22,7 @@ import java.util.List;
|
||||
* @date 2020年7月9日
|
||||
*/
|
||||
@Service
|
||||
@DS("compute")
|
||||
public class DownloadOriginalNewHouseCaseServiceImpl {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DownloadOriginalNewHouseCaseServiceImpl.class);
|
||||
@ -29,20 +31,16 @@ public class DownloadOriginalNewHouseCaseServiceImpl {
|
||||
private DownloadOriginalNewHouseCaseMapper downloadOriginalNewHouseCaseMapper;
|
||||
@Autowired
|
||||
private OriginalNewHouseCaseMapper originalNewHouseCaseMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
* 每月9号下载第一批案例数据
|
||||
* 每月10号下载第一批案例数据
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 9 * ?")
|
||||
public void downloadFirst() {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
|
||||
Integer yearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
|
||||
calendar.get(Calendar.MONTH) + 1));
|
||||
Integer yearMonth = DateUtils.getLastYearMonth();
|
||||
downloadFirst(yearMonth);
|
||||
afterFirst(yearMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +66,6 @@ public class DownloadOriginalNewHouseCaseServiceImpl {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -79,16 +76,10 @@ public class DownloadOriginalNewHouseCaseServiceImpl {
|
||||
/**
|
||||
* 每月25号下载第二批案例数据并且清洗第一批案例数据
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 25 * ?")
|
||||
public void downloadSecond() {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
|
||||
Integer yearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
|
||||
calendar.get(Calendar.MONTH) + 1));
|
||||
Integer yearMonth = DateUtils.getLastYearMonth();
|
||||
downloadSecond(yearMonth);
|
||||
afterSecond(yearMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,4 +120,132 @@ public class DownloadOriginalNewHouseCaseServiceImpl {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 第一批次入库后的更新操作
|
||||
*
|
||||
* @param tableRoute
|
||||
*/
|
||||
private void afterFirst(Integer tableRoute) {
|
||||
//
|
||||
try {
|
||||
jdbcTemplate.update("insert into obpm_LianCheng_Data.dbo.TLK_成交案例\n" +
|
||||
"(\n" +
|
||||
" ID\n" +
|
||||
" , ITEM_DEALID\n" +
|
||||
" , ITEM_SECTOR\n" +
|
||||
" , ITEM_CIRCLEPOSITION\n" +
|
||||
" , ITEM_DISTRICT\n" +
|
||||
" , ITEM_RANAME\n" +
|
||||
" , ITEM_HOUSEADDRESS\n" +
|
||||
" , ITEM_AREA\n" +
|
||||
" , ITEM_SUMPRICE\n" +
|
||||
" , ITEM_UNITPRICE\n" +
|
||||
" , ITEM_SIGNINGDATA\n" +
|
||||
" , ITEM_FLOOR\n" +
|
||||
" , ITEM_ROOMNATURE\n" +
|
||||
" , ITEM_APARTMENT\n" +
|
||||
" , ITEM_DEALTYPE\n" +
|
||||
" , ITEM_CALCULATIONUNITPRICE\n" +
|
||||
" , ITEM_CONSULTUNITPRICE\n" +
|
||||
" , ITEM_CONSULTTOTALPRICE\n" +
|
||||
" , ITEM_YEARMONTH\n" +
|
||||
" , ITEM_CALCULATIONTOTALPRICE\n" +
|
||||
" , ITEM_HOUSETYPE\n" +
|
||||
" , case_id\n" +
|
||||
")\n" +
|
||||
"select newid()\n" +
|
||||
" , replace(newid(), '-', '')\n" +
|
||||
" , case_block\n" +
|
||||
" , case_loop\n" +
|
||||
" , case_county\n" +
|
||||
" , case_community_name\n" +
|
||||
" , case_address\n" +
|
||||
" , case_area\n" +
|
||||
" , case_total_price\n" +
|
||||
" , case_unit_price\n" +
|
||||
" , case_signing_date\n" +
|
||||
" , case_floor\n" +
|
||||
" , case_house_property\n" +
|
||||
" , case_apartment_layout\n" +
|
||||
" , '一手'\n" +
|
||||
" , compute_unit_price\n" +
|
||||
" , reference_unit_price\n" +
|
||||
" , reference_total_price\n" +
|
||||
" , '" + (tableRoute / 100) + "-" + String.format("%02d", (tableRoute % 100)) + "'\n" +
|
||||
" , compute_total_price\n" +
|
||||
" , case_house_type\n" +
|
||||
" , case_id\n" +
|
||||
"from uv_compute.dbo.original_new_house_case_" + tableRoute + ";");
|
||||
} catch (Exception e) {
|
||||
logger.error("第一批次案例推送成交案例库异常", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二批次入库后的更新操作
|
||||
*
|
||||
* @param tableRoute
|
||||
*/
|
||||
private void afterSecond(Integer tableRoute) {
|
||||
//
|
||||
try {
|
||||
jdbcTemplate.update("insert into obpm_LianCheng_Data.dbo.TLK_成交案例\n" +
|
||||
"(\n" +
|
||||
" ID\n" +
|
||||
" , ITEM_DEALID\n" +
|
||||
" , ITEM_SECTOR\n" +
|
||||
" , ITEM_CIRCLEPOSITION\n" +
|
||||
" , ITEM_DISTRICT\n" +
|
||||
" , ITEM_RANAME\n" +
|
||||
" , ITEM_HOUSEADDRESS\n" +
|
||||
" , ITEM_AREA\n" +
|
||||
" , ITEM_SUMPRICE\n" +
|
||||
" , ITEM_UNITPRICE\n" +
|
||||
" , ITEM_SIGNINGDATA\n" +
|
||||
" , ITEM_FLOOR\n" +
|
||||
" , ITEM_ROOMNATURE\n" +
|
||||
" , ITEM_APARTMENT\n" +
|
||||
" , ITEM_DEALTYPE\n" +
|
||||
" , ITEM_CALCULATIONUNITPRICE\n" +
|
||||
" , ITEM_CONSULTUNITPRICE\n" +
|
||||
" , ITEM_CONSULTTOTALPRICE\n" +
|
||||
" , ITEM_YEARMONTH\n" +
|
||||
" , ITEM_CALCULATIONTOTALPRICE\n" +
|
||||
" , ITEM_HOUSETYPE\n" +
|
||||
" , case_id\n" +
|
||||
")\n" +
|
||||
"select newid()\n" +
|
||||
" , replace(newid(), '-', '')\n" +
|
||||
" , case_block\n" +
|
||||
" , case_loop\n" +
|
||||
" , case_county\n" +
|
||||
" , case_community_name\n" +
|
||||
" , case_address\n" +
|
||||
" , case_area\n" +
|
||||
" , case_total_price\n" +
|
||||
" , case_unit_price\n" +
|
||||
" , case_signing_date\n" +
|
||||
" , case_floor\n" +
|
||||
" , case_house_property\n" +
|
||||
" , case_apartment_layout\n" +
|
||||
" , '一手'\n" +
|
||||
" , compute_unit_price\n" +
|
||||
" , reference_unit_price\n" +
|
||||
" , reference_total_price\n" +
|
||||
" , '" + (tableRoute / 100) + "-" + String.format("%02d", (tableRoute % 100)) + "'\n" +
|
||||
" , compute_total_price\n" +
|
||||
" , case_house_type\n" +
|
||||
" , case_id\n" +
|
||||
"from uv_compute.dbo.original_new_house_case_" + tableRoute + "_update;");
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("第二批次案例推送成交案例库异常", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,8 +13,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.ruoyi;
|
||||
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.project.data.cases.domain.*;
|
||||
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
|
||||
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
|
||||
@ -93,7 +94,7 @@ public class GenerateTableTests {
|
||||
|
||||
@Test
|
||||
public void generateBatchGuoHaoInsertSqL() {
|
||||
Class targetClass = OriginalResidenceSaleOpeningCase .class;
|
||||
Class targetClass = OriginalResidenceSaleOpeningCase.class;
|
||||
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
while (targetClass != null) {
|
||||
@ -118,41 +119,56 @@ public class GenerateTableTests {
|
||||
originalNewHouseCase.setCaseLabel("车位");
|
||||
}
|
||||
|
||||
Assert.assertTrue(Objects.equals("车位",originalNewHouseCase.getCaseLabel()));
|
||||
Assert.assertTrue(Objects.equals("车位", originalNewHouseCase.getCaseLabel()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printLoop() {
|
||||
OriginalNewHouseCase originalNewHouseCase = new OriginalNewHouseCase();
|
||||
OriginalNewHouseCase originalNewHouseCase = new OriginalNewHouseCase();
|
||||
originalNewHouseCase.setCaseCounty("浦东");
|
||||
originalNewHouseCase.setCaseAddress("昌邑路55弄164室");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(2005,10,16);
|
||||
calendar.set(2005, 10, 16);
|
||||
originalNewHouseCase.setCaseSigningDate(calendar.getTime());
|
||||
Assert.assertEquals("4868c51874ba68c7fa2c96eeac02cde7",originalNewHouseCase.getCaseId());
|
||||
Assert.assertEquals("4868c51874ba68c7fa2c96eeac02cde7", originalNewHouseCase.getCaseId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void print2019Query(){
|
||||
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层';");
|
||||
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(){
|
||||
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层';");
|
||||
System.out.println("SELECT * FROM dbo.一手房成交数据" + i + " where 房屋地址='联茂路80号1层';");
|
||||
System.out.println("SELECT * FROM dbo.一手房成交数据" + i + "_update where 房屋地址='联茂路80号1层';");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printLoop2(){
|
||||
for (int i = 201901; i <= 201912; i++) {
|
||||
System.out.println(i);
|
||||
public void printLoop2() {
|
||||
for (int i = 201701; i <= 201712; i++) {
|
||||
System.out.println("SELECT * FROM dbo.original_new_house_case_" + i + " where " +
|
||||
"case_id='52de6447d8d55974cae721c13711768b'");
|
||||
}
|
||||
for (int i = 201801; i <= 201812; i++) {
|
||||
System.out.println("SELECT * FROM dbo.original_new_house_case_" + i + " where " +
|
||||
"case_id='52de6447d8d55974cae721c13711768b'");
|
||||
}
|
||||
for (int i = 201901; i <= 201912; i++) {
|
||||
System.out.println("SELECT * FROM dbo.original_new_house_case_" + i + " where " +
|
||||
"case_id='52de6447d8d55974cae721c13711768b'");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLastDate() {
|
||||
Integer lastYearMonth = DateUtils.getLastYearMonth();
|
||||
Assert.assertTrue(Objects.equals(202006, lastYearMonth));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,62 +19,347 @@ public class DownloadOriginalNewHouseCaseServiceImplTests {
|
||||
private DownloadOriginalNewHouseCaseServiceImpl downloadOriginalNewHouseCaseService;
|
||||
|
||||
/**
|
||||
* 下载第一批一手房案例
|
||||
* 一手案例初始化
|
||||
*/
|
||||
@Test
|
||||
public void testDownloadFirst() {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst();
|
||||
public void testInitCase() {
|
||||
testDownloadFirstBatch();
|
||||
|
||||
testDownloadSecondBatch();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 下载第一批一手房案例
|
||||
// */
|
||||
// @Test
|
||||
// public void testDownloadFirst() {
|
||||
// downloadOriginalNewHouseCaseService.downloadFirst();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 下载第二批一手房案例
|
||||
// */
|
||||
// @Test
|
||||
// public void testDownloadSecond() {
|
||||
// downloadOriginalNewHouseCaseService.downloadSecond();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 第一批一手成交案例
|
||||
*/
|
||||
@Test
|
||||
public void testDownloadFirstBatch() {
|
||||
// 时间要是线性的
|
||||
// 2017第一批一手成交案例
|
||||
for (int i = 201701; i <= 201712; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(i);
|
||||
}
|
||||
// 2018第一批一手成交案例
|
||||
for (int i = 201801; i <= 201812; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(i);
|
||||
}
|
||||
// 2019第一批一手成交案例
|
||||
for (int i = 201901; i <= 201912; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(i);
|
||||
}
|
||||
// 2020第一批一手成交案例
|
||||
for (int i = 202001; i <= 202006; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownload201709FirstBatch() {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(201709);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载第二批一手房案例
|
||||
* 2017第二批一手成交案例
|
||||
*/
|
||||
@Test
|
||||
public void testDownloadSecond() {
|
||||
downloadOriginalNewHouseCaseService.downloadSecond();
|
||||
public void testDownload2017SecondBatch() {
|
||||
// 一手房成交数据201701_201704_update
|
||||
// downloadOriginalNewHouseCaseService.downloadSecond(201704);
|
||||
// 一手房成交数据201707_update
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(201707);
|
||||
// 一手房成交数据201708_update
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(201708);
|
||||
// 一手房成交数据201711_update
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(201711);
|
||||
// 一手房成交数据201712_update
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(201712);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二批一手成交案例
|
||||
*/
|
||||
@Test
|
||||
public void testDownloadFistLoop() {
|
||||
for (int i = 202001; i <= 202005; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadSecondLoop() {
|
||||
for (int i = 202001; i <= 202005; i++) {
|
||||
public void testDownloadSecondBatch() {
|
||||
// 2018第二批一手成交案例
|
||||
for (int i = 201801; i <= 201812; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDownloadLastYearFistLoop() {
|
||||
Arrays.asList(201901, 201902, 201903, 201904, 201905, 201906, 201907, 201908, 201909, 201910, 201911, 201912).parallelStream().forEach(i -> {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(i);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownload201901First() {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(201901);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownload202003First() {
|
||||
downloadOriginalNewHouseCaseService.downloadFirst(202003);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadLastYearSecondLoop() {
|
||||
Arrays.asList(201901, 201902, 201903, 201904, 201905, 201906, 201907, 201908, 201909, 201910, 201911, 201912).parallelStream().forEach(i -> {
|
||||
// 2019第二批一手成交案例
|
||||
for (int i = 201901; i <= 201912; i++) {
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(i);
|
||||
}
|
||||
// 2020第二批一手成交案例
|
||||
Arrays.asList(202001, 202002, 202003, 202004, 202005, 202006).parallelStream().forEach(i -> {
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(i);
|
||||
});
|
||||
}
|
||||
|
||||
// 年表
|
||||
@Test
|
||||
public void testDownload201902Second() {
|
||||
downloadOriginalNewHouseCaseService.downloadSecond(201902);
|
||||
public void printInsert2017AggregationCaseTable() {
|
||||
StringBuilder sb = new StringBuilder("truncate table original_new_house_case_2017;\n");
|
||||
for (int i = 201701; i <= 201712; i++) {
|
||||
sb.append("insert into dbo.original_new_house_case_2017(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + ";\n");
|
||||
}
|
||||
sb.append("insert into dbo.original_new_house_case_2017(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_201701_201704_update;\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2017(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_201707_update;\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2017(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_201708_update;\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2017(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_201711_update;\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2017(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_201712_update;\n");
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 2018年表
|
||||
*/
|
||||
@Test
|
||||
public void printInsert2018AggregationCaseTable() {
|
||||
StringBuilder sb = new StringBuilder("truncate table original_new_house_case_2018;\n");
|
||||
for (int i = 201801; i <= 201812; i++) {
|
||||
sb.append("insert into dbo.original_new_house_case_2018(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + ";\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2018(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + "_update;\n");
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 2019年表
|
||||
*/
|
||||
@Test
|
||||
public void printInsert2019AggregationCaseTable() {
|
||||
StringBuilder sb = new StringBuilder("truncate table original_new_house_case_2019;\n");
|
||||
for (int i = 201901; i <= 201912; i++) {
|
||||
sb.append("insert into dbo.original_new_house_case_2019(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + ";\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2019(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + "_update;\n");
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 2020年表
|
||||
*/
|
||||
@Test
|
||||
public void printInsert2020AggregationCaseTable() {
|
||||
StringBuilder sb = new StringBuilder("truncate table original_new_house_case_2020;\n");
|
||||
for (int i = 202001; i <= 202006; i++) {
|
||||
sb.append("insert into dbo.original_new_house_case_2020(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + ";\n");
|
||||
sb.append("insert into dbo.original_new_house_case_2020(case_id ,case_county ,case_block ,case_loop ," +
|
||||
"case_community_name ,case_address ,case_area ,case_unit_price ,case_total_price ,case_house_type" +
|
||||
" ,case_signing_date ,case_floor ,case_house_property ,case_apartment_layout ,compute_unit_price " +
|
||||
",compute_total_price ,reference_unit_price ,reference_total_price ,case_label ,create_time) \n" +
|
||||
"SELECT case_id ,case_county ,case_block ,case_loop ,case_community_name ,case_address ,case_area" +
|
||||
" ,case_unit_price ,case_total_price ,case_house_type ,case_signing_date ,case_floor ," +
|
||||
"case_house_property ,case_apartment_layout ,compute_unit_price ,compute_total_price ," +
|
||||
"reference_unit_price ,reference_total_price ,case_label ,create_time FROM dbo" +
|
||||
".original_new_house_case_" + i + "_update;\n");
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printLoop() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 202001; i <= 202006; i++) {
|
||||
sb.append("insert into dbo.TLK_成交案例\n" +
|
||||
"(\n" +
|
||||
" ID\n" +
|
||||
" , ITEM_DEALID\n" +
|
||||
" , ITEM_SECTOR\n" +
|
||||
" , ITEM_CIRCLEPOSITION\n" +
|
||||
" , ITEM_DISTRICT\n" +
|
||||
" , ITEM_RANAME\n" +
|
||||
" , ITEM_HOUSEADDRESS\n" +
|
||||
" , ITEM_AREA\n" +
|
||||
" , ITEM_SUMPRICE\n" +
|
||||
" , ITEM_UNITPRICE\n" +
|
||||
" , ITEM_SIGNINGDATA\n" +
|
||||
" , ITEM_FLOOR\n" +
|
||||
" , ITEM_ROOMNATURE\n" +
|
||||
" , ITEM_APARTMENT\n" +
|
||||
" , ITEM_DEALTYPE\n" +
|
||||
" , ITEM_CALCULATIONUNITPRICE\n" +
|
||||
" , ITEM_CONSULTUNITPRICE\n" +
|
||||
" , ITEM_CONSULTTOTALPRICE\n" +
|
||||
" , ITEM_YEARMONTH\n" +
|
||||
" , ITEM_CALCULATIONTOTALPRICE\n" +
|
||||
" , ITEM_HOUSETYPE\n" +
|
||||
" , case_id\n" +
|
||||
")\n" +
|
||||
"select newid()\n" +
|
||||
" , replace(newid(), '-', '')\n" +
|
||||
" , case_block\n" +
|
||||
" , case_loop\n" +
|
||||
" , case_county\n" +
|
||||
" , case_community_name\n" +
|
||||
" , case_address\n" +
|
||||
" , case_area\n" +
|
||||
" , case_total_price\n" +
|
||||
" , case_unit_price\n" +
|
||||
" , case_signing_date\n" +
|
||||
" , case_floor\n" +
|
||||
" , case_house_property\n" +
|
||||
" , case_apartment_layout\n" +
|
||||
" , '一手'\n" +
|
||||
" , compute_unit_price\n" +
|
||||
" , reference_unit_price\n" +
|
||||
" , reference_total_price\n" +
|
||||
" , '" + (i / 100) + "-" + String.format("%02d",(i % 100)) + "'\n" +
|
||||
" , compute_total_price\n" +
|
||||
" , case_house_type\n" +
|
||||
" , case_id\n" +
|
||||
"from uv_compute.dbo.original_new_house_case_" + i + ";\n");
|
||||
sb.append("insert into dbo.TLK_成交案例\n" +
|
||||
"(\n" +
|
||||
" ID\n" +
|
||||
" , ITEM_DEALID\n" +
|
||||
" , ITEM_SECTOR\n" +
|
||||
" , ITEM_CIRCLEPOSITION\n" +
|
||||
" , ITEM_DISTRICT\n" +
|
||||
" , ITEM_RANAME\n" +
|
||||
" , ITEM_HOUSEADDRESS\n" +
|
||||
" , ITEM_AREA\n" +
|
||||
" , ITEM_SUMPRICE\n" +
|
||||
" , ITEM_UNITPRICE\n" +
|
||||
" , ITEM_SIGNINGDATA\n" +
|
||||
" , ITEM_FLOOR\n" +
|
||||
" , ITEM_ROOMNATURE\n" +
|
||||
" , ITEM_APARTMENT\n" +
|
||||
" , ITEM_DEALTYPE\n" +
|
||||
" , ITEM_CALCULATIONUNITPRICE\n" +
|
||||
" , ITEM_CONSULTUNITPRICE\n" +
|
||||
" , ITEM_CONSULTTOTALPRICE\n" +
|
||||
" , ITEM_YEARMONTH\n" +
|
||||
" , ITEM_CALCULATIONTOTALPRICE\n" +
|
||||
" , ITEM_HOUSETYPE\n" +
|
||||
" , case_id\n" +
|
||||
")\n" +
|
||||
"select newid()\n" +
|
||||
" , replace(newid(), '-', '')\n" +
|
||||
" , case_block\n" +
|
||||
" , case_loop\n" +
|
||||
" , case_county\n" +
|
||||
" , case_community_name\n" +
|
||||
" , case_address\n" +
|
||||
" , case_area\n" +
|
||||
" , case_total_price\n" +
|
||||
" , case_unit_price\n" +
|
||||
" , case_signing_date\n" +
|
||||
" , case_floor\n" +
|
||||
" , case_house_property\n" +
|
||||
" , case_apartment_layout\n" +
|
||||
" , '一手'\n" +
|
||||
" , compute_unit_price\n" +
|
||||
" , reference_unit_price\n" +
|
||||
" , reference_total_price\n" +
|
||||
" , '" + (i / 100) + "-" + String.format("%02d",(i % 100)) + "'\n" +
|
||||
" , compute_total_price\n" +
|
||||
" , case_house_type\n" +
|
||||
" , case_id\n" +
|
||||
"from uv_compute.dbo.original_new_house_case_" + i + "_update;\n");
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user