feat(每月作价):优化住宅售价计算

1. 成交案例下载和清洗
2. 挂牌案例下载、上传、清洗
3. 编写单元测试
This commit is contained in:
purple 2020-06-17 18:39:19 +08:00
parent 517f42edf5
commit 0d14af53ac
35 changed files with 4271 additions and 1 deletions

View File

@ -0,0 +1,36 @@
import request from '@/utils/request'
// 查询最终住宅租赁基价列表
export function list(query) {
return request({
url: '/data/base/price/list',
method: 'get',
params: query
})
}
// 查询最终住宅租赁基价详细
export function get(id) {
return request({
url: '/data/base/price/' + id,
method: 'get'
})
}
// 修改最终住宅租赁基价
export function update(data) {
return request({
url: '/data/base/price',
method: 'put',
data: data
})
}
// 导出最终住宅租赁基价
export function export2File(query) {
return request({
url: '/data/base/price/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,36 @@
import request from '@/utils/request'
// 查询最终住宅租赁基价列表
export function list(query) {
return request({
url: '/data/base/price/list',
method: 'get',
params: query
})
}
// 查询最终住宅租赁基价详细
export function get(id) {
return request({
url: '/data/base/price/' + id,
method: 'get'
})
}
// 修改最终住宅租赁基价
export function update(data) {
return request({
url: '/data/base/price',
method: 'put',
data: data
})
}
// 导出最终住宅租赁基价
export function export2File(query) {
return request({
url: '/data/base/price/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,150 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="案例年月" prop="yearMonth">
<el-input
v-model="queryParams.yearMonth"
placeholder="请输入案例年月"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="案例小区名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入案例小区名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="案例小区地址" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入案例小区地址"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
style="width: 100%;"
>
<el-table-column label="序号" type="index" align="center">
<template slot-scope="scope">
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
<el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="部门名称" align="center" prop="deptName" />
<el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
<el-table-column label="登录地点" align="center" prop="loginLocation" />
<el-table-column label="浏览器" align="center" prop="browser" />
<el-table-column label="操作系统" align="center" prop="os" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleForceLogout(scope.row)"
v-hasPermi="['monitor:online:forceLogout']"
>强退</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
</div>
</template>
<script>
import { list, forceLogout } from "@/api/monitor/online";
export default {
name: "Online",
data() {
return {
//
loading: true,
//
total: 0,
//
list: [],
pageNum: 1,
pageSize: 10,
//
queryParams: {
yearMonth: undefined,
name: undefined,
address: undefined,
//
saleOrRent: undefined,
countyName: undefined,
ipaddr: undefined,
userName: undefined
}
};
},
created() {
this.getList();
},
methods: {
/** 查询登录日志列表 */
getList() {
this.loading = true;
list(this.queryParams).then(response => {
this.list = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 强退按钮操作 */
handleForceLogout(row) {
this.$confirm(
'是否确认强退名称为"' + row.userName + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(function() {
return forceLogout(row.tokenId);
})
.then(() => {
this.getList();
this.msgSuccess("强退成功");
})
.catch(function() {});
}
}
};
</script>

View File

@ -0,0 +1,464 @@
<template>
<div class="app-container">
<el-form :model="queryParams" :rules="rules" ref="queryForm" :inline="true" label-width="100px">
<el-form-item label="联城小区ID" prop="communityId" clearable>
<el-input
v-model="queryParams.communityId"
placeholder="请输入案例小区名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="小区类型" prop="communityType" clearable>
<el-select v-model="queryParams.communityType" placeholder="请输入小区类型">
<el-option
v-for="item in communityTypeOptions"
:value="item.value"
:label="item.label"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="价格类型" prop="priceType" clearable>
<el-select v-model="queryParams.priceType" placeholder="请输入价格类型">
<el-option
v-for="item in priceTypeOptions"
:value="item.value"
:label="item.label"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="价值时点" prop="valuePoint" clearable>
<el-date-picker
v-model="queryParams.valuePoint"
format="yyyy-MM"
value-format="yyyy-MM"
type="month"
placeholder="选择年月"
@keyup.enter.native="handleQuery"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:user:edit']"
>修改</el-button>
</el-col>-->
<!-- <el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:user:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['system:user:import']"
>导入</el-button>
</el-col>-->
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="小区ID" align="center" prop="communityId" />
<el-table-column label="项目类型" align="center" prop="communityType">
<template slot-scope="scope">
<el-tag size="big" v-if="1 == scope.row.communityType">住宅</el-tag>
<el-tag size="big" type="success" v-if="2 == scope.row.communityType">办公</el-tag>
</template>
</el-table-column>
<!-- <el-table-column
label=""
align="center"
prop=""
:formatter="priceTypeFormatter"
/> -->
<el-table-column label="价格类型" align="center" prop="priceType">
<template slot-scope="scope">
<el-tag size="big" v-if="1 == scope.row.priceType">售价</el-tag>
<el-tag size="big" type="success" v-if="2 == scope.row.priceType">租金</el-tag>
</template>
</el-table-column>
<el-table-column label="价值时点" align="center" prop="valuePoint" />
<el-table-column label="标准基价" align="center" prop="standardPrice" />
<el-table-column label="主力面积基价" align="center" prop="mainAreaPrice" />
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:user:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:user:remove']"
>删除</el-button>
</template>
</el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改办公基价对话框 -->
<!-- <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="160px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="小区ID">
<el-input v-model="form.communityId" disabled="true" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="楼栋ID">
<el-input v-model="form.buildingId" disabled="true" readonly />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主力基价(元/㎡)">
<el-input v-model="form.mainPrice" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主力租金(元/月·㎡)">
<el-input v-model="form.mainPriceRent" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主力基价涨跌幅">
<el-input v-model="form.mainPricePst" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主力租金涨跌幅">
<el-input v-model="form.mainPriceRentPst" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主力基价类型">
<el-input v-model="form.mainPriceType" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主力租金类型">
<el-input v-model="form.mainPriceRentType" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div class="el-upload__tip" style="color:red" slot="tip">提示仅允许导入xlsxlsx格式文件</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>-->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import {
list,
get,
update,
export2File,
getYearMonthList
} from "@/api/data/basePrice";
export default {
name: "basePrice",
data() {
//
var checkYearMonth = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入年月"));
} else if (value === "" || isNaN(parseInt(value))) {
callback(new Error("请输入年月"));
} else {
callback();
}
};
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
total: 0,
//
dataList: [],
//
title: "",
//
open: false,
//
queryParams: {
communityId: undefined,
communityType: undefined,
priceType: undefined,
valuePoint: undefined,
pageNum: 1,
pageSize: 10
},
yearMonthList: [],
priceTypeOptions: [
{ value: 1, label: "售价" },
{ value: 2, label: "租金" }
],
communityTypeOptions: [
{ value: 1, label: "住宅" },
{ value: 2, label: "办公" }
],
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
headers: { Authorization: "Bearer " + getToken() },
//
url:
process.env.VUE_APP_BASE_API +
"/data/compute/rentprice/residence/importData"
},
//
form: {},
//
rules: {
yearMonth: [
{ validator: checkYearMonth, trigger: "blur" },
{ validator: checkYearMonth, trigger: "change" }
]
}
};
},
created() {
this.loading = false;
// getYearMonthList().then(response => {
// this.yearMonthList = response.data;
// });
},
methods: {
priceTypeFormatter: function(row, column, cellValue, index) {
if (1 === cellValue) {
return "售价";
} else if (2 === cellValue) {
return "租金";
} else {
return "";
}
},
communityTypeFormatter: function(row, column, cellValue, index) {
if (1 === cellValue) {
return "住宅";
} else if (2 === cellValue) {
return "办公";
} else {
return "";
}
},
yesOrNotFormatter: function(row, column, cellValue, index) {
if (cellValue) return "是";
return "否";
},
statusFormatter: function(row, column, cellValue, index) {
if (cellValue) return "正常";
return "失效";
},
dateFormatter: function(row, column, cellValue, index) {
if (cellValue) {
return cellValue.substring(0, 10);
}
return "";
},
/** 查询办公基价列表 */
getList() {
this.$refs["queryForm"].validate(valid => {
if (valid) {
this.loading = true;
list(this.queryParams).then(response => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
}
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
// handleAdd() {
// this.reset();
// this.open = true;
// this.title = "";
// },
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
get(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改办公基价";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
update(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
} else {
this.msgError(response.msg);
}
});
} else {
// addUltimate(this.form).then(response => {
// if (response.code === 200) {
// this.msgSuccess("");
// this.open = false;
// this.getList();
// } else {
// this.msgError(response.msg);
// }
// });
}
}
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有住宅租赁基价数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return export2File(queryParams);
})
.then(response => {
this.download(response.msg);
})
.catch(function() {});
},
handleImport() {
this.upload.title = "办公基价导入";
this.upload.open = true;
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
}
}
};
</script>

View File

@ -0,0 +1,143 @@
package com.ruoyi.common.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class LoadUtil {
private static final int SIZE = 1024;
private static final String CHARSET_NAME = "UTF-8";
public static String loadContent(String name) {
InputStream is = null;
try {
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
StringBuffer stringBuffer = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE);
char[] buf = new char[1024];
int numRead = 0;
while ((numRead = reader.read(buf)) != -1) {
String readData = String.valueOf(buf, 0, numRead);
stringBuffer.append(readData);
buf = new char[1024];
}
reader.close();
return stringBuffer.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
/**
* @param name
* @return
*/
public static List<String> loadList(String name) {
List<String> result = new ArrayList<>();
InputStream is = null;
try {
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
BufferedReader br = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE);
String theWord = null;
do {
try {
theWord = br.readLine();
if (null != theWord)
result.add(theWord);
} catch (IOException e) {
e.printStackTrace();
}
} while (theWord != null);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
// 这样写有什么问题吗
// private static BufferedReader readLine(String name) {
// InputStream is = null;
// try {
// is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
// BufferedReader br = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE);
// return br;
// } catch (IOException e) {
// e.printStackTrace();
// } finally {
// try {
// if (is != null) {
// is.close();
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
// return null;
// }
/**
* @param name
* @return
*/
public static Map<String, String> loadDict(String name) {
Map<String, String> result = new LinkedHashMap<>();
InputStream is = null;
try {
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
BufferedReader br = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE);
String theWord = null;
do {
try {
theWord = br.readLine();
if (null != theWord) {
String[] pair = theWord.split(" ");
result.put(pair[0], pair[1]);
}
} catch (IOException e) {
e.printStackTrace();
}
} while (theWord != null);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.project.data.basis.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.web.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
public class UVBasePrice extends BaseEntity {
/**
* 小区id
*/
private String communityId;
/**
* 价格类型
*/
private Integer priceType;
/**
* 小区类型(1住宅2办公)
*/
private Integer communityType;
/**
* 基价售价租金
*/
private BigDecimal standardPrice;
/**
* 主力面积基价售价租金
*/
private BigDecimal mainAreaPrice;
/**
* 价值时点
*/
@JsonFormat(pattern="yyyy-MM-dd")
private Date valuePoint;
/**
* 修改说明
*/
private String comment;
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public Integer getPriceType() {
return priceType;
}
public void setPriceType(Integer priceType) {
this.priceType = priceType;
}
public Integer getCommunityType() {
return communityType;
}
public void setCommunityType(Integer communityType) {
this.communityType = communityType;
}
public BigDecimal getStandardPrice() {
return standardPrice;
}
public void setStandardPrice(BigDecimal standardPrice) {
this.standardPrice = standardPrice;
}
public BigDecimal getMainAreaPrice() {
return mainAreaPrice;
}
public void setMainAreaPrice(BigDecimal mainAreaPrice) {
this.mainAreaPrice = mainAreaPrice;
}
public Date getValuePoint() {
return valuePoint;
}
public void setValuePoint(Date valuePoint) {
this.valuePoint = valuePoint;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.project.data.basis.domain;
public class UVBasePriceQueryModel extends UVBasePrice {
private Integer pageIndex;
private Integer pageSize;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.project.data.basis.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.basis.domain.UVBasePrice;
import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel;
import java.util.List;
@DS("teemlink")
public interface UVBasePriceMapper {
/**
* 分页总数
*
* @param uvBasePrice
* @return
*/
Integer pageCount(UVBasePrice uvBasePrice);
/**
* @param queryModel
* @return
*/
List<UVBasePrice> pageList(UVBasePriceQueryModel queryModel);
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.project.data.basis.service;
import com.ruoyi.project.data.basis.domain.UVBasePrice;
import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel;
import java.util.List;
public interface IUVBasePriceService{
/**
* 分页查询
*
* @param queryModel
* @return
*/
List<UVBasePrice> pageList(UVBasePriceQueryModel queryModel);
/**
*
* @param queryModel
* @return
*/
Integer pageCount(UVBasePriceQueryModel queryModel);
}

View File

@ -0,0 +1,69 @@
package com.ruoyi.project.data.basis.service.impl;
import com.ruoyi.project.data.basis.domain.LianJiaCommunityDict;
import com.ruoyi.project.data.basis.domain.UVBasePrice;
import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel;
import com.ruoyi.project.data.basis.mapper.LianJiaCommunityDictMapper;
import com.ruoyi.project.data.basis.mapper.UVBasePriceMapper;
import com.ruoyi.project.data.basis.service.ILianJiaCommunityDictService;
import com.ruoyi.project.data.basis.service.IUVBasePriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UVBasePriceServiceImpl implements IUVBasePriceService {
@Autowired
private UVBasePriceMapper uvBasePriceMapper;
// @Override
// public int insert(LianJiaCommunityDict dict) {
// return jdbcTemplate.update("insert into [dbo].[lianjia_dictionary]([lianjia_community_id]," +
// "[lianjia_community_name]," +
// "[lianjia_community_address],[lianjia_community_url],[lianjia_community_curl],[community_id]," +
// "[building_id],[clean_community_name],[clean_community_address],[clean_building_address],[enable]," +
// "[create_time]) value (?,?,?,?,?,?,?,?,?,?,1,getdate());", new Object[]{dict.getLianJiaCommunityId(),
// dict.getLianJiaCommunityName(), dict.getLianJiaCommunityAddress(), dict.getLianJiaUrl(),
// dict.getLianJiaCommunityUrl(), dict.getCommunityId(), dict.getBuildingId(), dict
// .getCleanCommunityName()
// , dict.getCleanCommunityAddress(), dict.getCleanBuildingAddress()});
// }
//
// @Override
// public int update(LianJiaCommunityDict dict) {
// return 0;
// }
//
// @Override
// public int delete(Integer id) {
// return jdbcTemplate.update("delete from lianjia_dictionary where id= ? ;", new Object[]{id});
// }
//
// @Override
// public List<LianJiaCommunityDict> selectPageOfList(LianJiaCommunityDict dict) {
// return lianJiaCommunityDictMapper.selectPageOfList(dict);
// }
//
// @Override
// public int selectPageOfTotal(LianJiaCommunityDict dict) {
// return lianJiaCommunityDictMapper.selectPageOfTotal(dict);
// }
//
// @Override
// public LianJiaCommunityDict selectById(Integer id) {
// return lianJiaCommunityDictMapper.selectById(id);
// }
@Override
public List<UVBasePrice> pageList(UVBasePriceQueryModel queryModel) {
return uvBasePriceMapper.pageList(queryModel);
}
@Override
public Integer pageCount(UVBasePriceQueryModel queryModel) {
return uvBasePriceMapper.pageCount(queryModel);
}
}

View File

@ -28,5 +28,4 @@ public class CasesController {
}
}

View File

@ -0,0 +1,819 @@
package com.ruoyi.project.data.cases.domain;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.util.DigestUtils;
import java.math.BigDecimal;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 住宅成交案例
*/
public class OriginalResidenceSaleClosingCase {
private static final SimpleDateFormat simplaDateFormat = new SimpleDateFormat("yyyy-MM-dd");
private static List<String> juzhu = new LinkedList<>();
private static List<String> bangong = new LinkedList<>();
private static List<String> shangye = new LinkedList<>();
static {
juzhu.add("办公楼");
juzhu.add("商铺");
juzhu.add("未知");
juzhu.add("其它");
juzhu.add("工厂");
juzhu.add("车库");
bangong.add("办公");
bangong.add("办公楼");
bangong.add("写字楼");
shangye.add("商铺");
shangye.add("商店");
}
/**
* 唯一标识
*/
private String caseId;
/**
* 小区名称
*/
private String caseCommunityName;
/**
* 房屋地址
*/
private String caseAddress;
/**
* 区域
*/
private String caseCountyName;
private String cleanCountyName;
/**
* 板块
*/
private String caseBlockName;
private String cleanBlockName;
/**
* 环线
*/
private String caseLoopName;
private String cleanLoopName;
/**
* 合同编号
*/
private String caseContractNumber;
/**
* 房源编号
*/
private String caseNumber;
/**
* 户型
*/
private String caseApartmentLayout;
/**
* 面积
*/
private BigDecimal caseArea;
/**
* 朝向
*/
private String caseToward;
/**
* 楼层
*/
private String caseStorey;
/**
* 总楼层
*/
private String cleanTotalFloor;
/**
* 地上层数
*/
private Integer cleanGroundFloor;
/**
* 所在层
*/
private Integer cleanCurrentFloor;
/**
* 所在楼层描述
*/
private String cleanCurrentFloorDesc;
/**
* 登记日期
*/
private Date caseRegisterDate;
/**
* 签约日期
*/
private Date caseSigningDate;
/**
* 挂牌价格
*/
private BigDecimal caseOpeningPrice;
/**
* 成交总价
*/
private BigDecimal caseTotalPrice;
/**
* 成交单价
*/
private BigDecimal caseUnitPrice;
/**
* 抓取日期
*/
private Date caseGetDate;
/**
* 成交URL
*/
private String caseUrl;
/**
* 中介公司
*/
private String agencyName;
/**
* 中介类型
*/
private String agencyType;
/**
* 卖家类型
*/
private String sellerType;
/**
* 买家类型
*/
private String buyerType;
/**
* 出生年月日
*/
private Date birthday;
/**
* 抓取网站名
*/
private String caseProvider;
/**
* 房屋类型(公寓 口径后面提供)
*/
private String caseHouseType;
/**
* 成交类型 必填 二手 取值一手二手
*/
private Integer cleanCaseType;
/**
* 单套地址
*/
private String cleanCondoAddress;
/**
* 楼栋地址
*/
private String cleanBuildingAddress;
/**
* 房屋地址(一手二手)(规范) 浦城路366弄8号1803 地址匹配中间结果
* 应该是单套地址
*/
private String cleanAddress;
/**
* 单套id
*/
private String cleanCondoId;
/**
* 楼栋id
*/
private String cleanBuildingId;
/**
* 小区id
*/
private String cleanCommunityId;
/**
* 楼栋系数
*/
private BigDecimal buildingCoefficient;
/**
* 单套系数
*/
private BigDecimal condoAreaCoefficient;
/**
* 竣工日期
*/
private Integer caseYear;
/**
* 年份系数
*/
private BigDecimal yearCoefficient;
/**
* 主力面积基价
*/
private BigDecimal areaCoefficient;
/**
* 物业档次
*/
private String cleanProjectLevel;
/**
* 电梯
*/
private String caseElevator;
private Boolean cleanElevator;
/**
* 电梯系数
*/
private Integer elevatorCoefficient;
/**
* 没有电梯系数
*/
private Integer noElevatorCoefficient;
/**
* 楼层修正系数
*/
private BigDecimal floorCoefficient;
/***
* 评估单价
*/
private BigDecimal appraiseUnitPrice;
/**
* 评估总价
*/
private BigDecimal appraiseTotalPrice;
/**
* 物业类型
*/
private String cleanPropertyType;
/**
* 房屋性质
*/
private String caseHouseProperty;
/**
* 计算总价
*/
private BigDecimal computeTotalPrice;
/**
* 计算单价
*/
private BigDecimal computeUnitPrice;
/**
* 参考总价
*/
private BigDecimal refTotalPrice;
/**
* 参考单价
*/
private BigDecimal refUnitPrice;
public String getCaseId() {
return caseId;
}
public void setCaseId(String caseId) {
this.caseId = caseId;
}
public String getCaseCommunityName() {
return caseCommunityName;
}
public void setCaseCommunityName(String caseCommunityName) {
this.caseCommunityName = caseCommunityName;
}
public String getCaseAddress() {
return caseAddress;
}
public void setCaseAddress(String caseAddress) {
this.caseAddress = caseAddress;
}
public String getCaseCountyName() {
return caseCountyName;
}
public void setCaseCountyName(String caseCountyName) {
this.caseCountyName = caseCountyName;
}
public String getCleanCountyName() {
return cleanCountyName;
}
public void setCleanCountyName(String cleanCountyName) {
this.cleanCountyName = cleanCountyName;
}
public String getCaseBlockName() {
return caseBlockName;
}
public void setCaseBlockName(String caseBlockName) {
this.caseBlockName = caseBlockName;
}
public String getCleanBlockName() {
return cleanBlockName;
}
public void setCleanBlockName(String cleanBlockName) {
this.cleanBlockName = cleanBlockName;
}
public String getCaseLoopName() {
return caseLoopName;
}
public void setCaseLoopName(String caseLoopName) {
this.caseLoopName = caseLoopName;
}
public String getCleanLoopName() {
return cleanLoopName;
}
public void setCleanLoopName(String cleanLoopName) {
this.cleanLoopName = cleanLoopName;
}
public String getCaseContractNumber() {
return caseContractNumber;
}
public void setCaseContractNumber(String caseContractNumber) {
this.caseContractNumber = caseContractNumber;
}
public String getCaseNumber() {
return caseNumber;
}
public void setCaseNumber(String caseNumber) {
this.caseNumber = caseNumber;
}
public String getCaseApartmentLayout() {
return caseApartmentLayout;
}
public void setCaseApartmentLayout(String caseApartmentLayout) {
this.caseApartmentLayout = caseApartmentLayout;
}
public BigDecimal getCaseArea() {
return caseArea;
}
public void setCaseArea(BigDecimal caseArea) {
this.caseArea = caseArea;
}
public String getCaseToward() {
return caseToward;
}
public void setCaseToward(String caseToward) {
this.caseToward = caseToward;
}
public String getCaseStorey() {
return caseStorey;
}
public void setCaseStorey(String caseStorey) {
this.caseStorey = caseStorey;
}
public String getCleanTotalFloor() {
return cleanTotalFloor;
}
public void setCleanTotalFloor(String cleanTotalFloor) {
this.cleanTotalFloor = cleanTotalFloor;
}
public Integer getCleanGroundFloor() {
return cleanGroundFloor;
}
public void setCleanGroundFloor(Integer cleanGroundFloor) {
this.cleanGroundFloor = cleanGroundFloor;
}
public Integer getCleanCurrentFloor() {
return cleanCurrentFloor;
}
public void setCleanCurrentFloor(Integer cleanCurrentFloor) {
this.cleanCurrentFloor = cleanCurrentFloor;
}
public Date getCaseRegisterDate() {
return caseRegisterDate;
}
public void setCaseRegisterDate(Date caseRegisterDate) {
this.caseRegisterDate = caseRegisterDate;
}
public Date getCaseSigningDate() {
return caseSigningDate;
}
public void setCaseSigningDate(Date caseSigningDate) {
this.caseSigningDate = caseSigningDate;
}
public BigDecimal getCaseOpeningPrice() {
return caseOpeningPrice;
}
public void setCaseOpeningPrice(BigDecimal caseOpeningPrice) {
this.caseOpeningPrice = caseOpeningPrice;
}
public BigDecimal getCaseTotalPrice() {
return caseTotalPrice;
}
public void setCaseTotalPrice(BigDecimal caseTotalPrice) {
this.caseTotalPrice = caseTotalPrice;
}
public BigDecimal getCaseUnitPrice() {
return caseUnitPrice;
}
public void setCaseUnitPrice(BigDecimal caseUnitPrice) {
this.caseUnitPrice = caseUnitPrice;
}
public Date getCaseGetDate() {
return caseGetDate;
}
public void setCaseGetDate(Date caseGetDate) {
this.caseGetDate = caseGetDate;
}
public String getCaseUrl() {
return caseUrl;
}
public void setCaseUrl(String caseUrl) {
this.caseUrl = caseUrl;
}
public String getAgencyName() {
return agencyName;
}
public void setAgencyName(String agencyName) {
this.agencyName = agencyName;
}
public String getAgencyType() {
return agencyType;
}
public void setAgencyType(String agencyType) {
this.agencyType = agencyType;
}
public String getSellerType() {
return sellerType;
}
public void setSellerType(String sellerType) {
this.sellerType = sellerType;
}
public String getBuyerType() {
return buyerType;
}
public void setBuyerType(String buyerType) {
this.buyerType = buyerType;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getCaseProvider() {
return caseProvider;
}
public void setCaseProvider(String caseProvider) {
this.caseProvider = caseProvider;
}
public String getCaseHouseType() {
return caseHouseType;
}
public void setCaseHouseType(String caseHouseType) {
this.caseHouseType = caseHouseType;
}
public Integer getCleanCaseType() {
return cleanCaseType;
}
public void setCleanCaseType(Integer cleanCaseType) {
this.cleanCaseType = cleanCaseType;
}
public String getCleanCondoAddress() {
return cleanCondoAddress;
}
public void setCleanCondoAddress(String cleanCondoAddress) {
this.cleanCondoAddress = cleanCondoAddress;
}
public String getCleanBuildingAddress() {
return cleanBuildingAddress;
}
public void setCleanBuildingAddress(String cleanBuildingAddress) {
this.cleanBuildingAddress = cleanBuildingAddress;
}
public String getCleanAddress() {
return cleanAddress;
}
public void setCleanAddress(String cleanAddress) {
this.cleanAddress = cleanAddress;
}
public String getCleanCondoId() {
return cleanCondoId;
}
public void setCleanCondoId(String cleanCondoId) {
this.cleanCondoId = cleanCondoId;
}
public String getCleanBuildingId() {
return cleanBuildingId;
}
public void setCleanBuildingId(String cleanBuildingId) {
this.cleanBuildingId = cleanBuildingId;
}
public String getCleanCommunityId() {
return cleanCommunityId;
}
public void setCleanCommunityId(String cleanCommunityId) {
this.cleanCommunityId = cleanCommunityId;
}
public BigDecimal getBuildingCoefficient() {
return buildingCoefficient;
}
public void setBuildingCoefficient(BigDecimal buildingCoefficient) {
this.buildingCoefficient = buildingCoefficient;
}
public BigDecimal getCondoAreaCoefficient() {
return condoAreaCoefficient;
}
public void setCondoAreaCoefficient(BigDecimal condoAreaCoefficient) {
this.condoAreaCoefficient = condoAreaCoefficient;
}
public Integer getCaseYear() {
return caseYear;
}
public void setCaseYear(Integer caseYear) {
this.caseYear = caseYear;
}
public BigDecimal getYearCoefficient() {
return yearCoefficient;
}
public void setYearCoefficient(BigDecimal yearCoefficient) {
this.yearCoefficient = yearCoefficient;
}
public BigDecimal getAreaCoefficient() {
return areaCoefficient;
}
public void setAreaCoefficient(BigDecimal areaCoefficient) {
this.areaCoefficient = areaCoefficient;
}
public String getCleanProjectLevel() {
return cleanProjectLevel;
}
public void setCleanProjectLevel(String cleanProjectLevel) {
this.cleanProjectLevel = cleanProjectLevel;
}
public String getCaseElevator() {
return caseElevator;
}
public void setCaseElevator(String caseElevator) {
this.caseElevator = caseElevator;
}
public Boolean getCleanElevator() {
return cleanElevator;
}
public void setCleanElevator(Boolean cleanElevator) {
this.cleanElevator = cleanElevator;
}
public Integer getElevatorCoefficient() {
return elevatorCoefficient;
}
public void setElevatorCoefficient(Integer elevatorCoefficient) {
this.elevatorCoefficient = elevatorCoefficient;
}
public Integer getNoElevatorCoefficient() {
return noElevatorCoefficient;
}
public void setNoElevatorCoefficient(Integer noElevatorCoefficient) {
this.noElevatorCoefficient = noElevatorCoefficient;
}
public BigDecimal getFloorCoefficient() {
return floorCoefficient;
}
public void setFloorCoefficient(BigDecimal floorCoefficient) {
this.floorCoefficient = floorCoefficient;
}
public BigDecimal getAppraiseUnitPrice() {
return appraiseUnitPrice;
}
public void setAppraiseUnitPrice(BigDecimal appraiseUnitPrice) {
this.appraiseUnitPrice = appraiseUnitPrice;
}
public BigDecimal getAppraiseTotalPrice() {
return appraiseTotalPrice;
}
public void setAppraiseTotalPrice(BigDecimal appraiseTotalPrice) {
this.appraiseTotalPrice = appraiseTotalPrice;
}
public String getCleanPropertyType() {
return cleanPropertyType;
}
public void setCleanPropertyType(String cleanPropertyType) {
this.cleanPropertyType = cleanPropertyType;
}
public String getCaseHouseProperty() {
return caseHouseProperty;
}
public void setCaseHouseProperty(String caseHouseProperty) {
this.caseHouseProperty = caseHouseProperty;
}
public BigDecimal getComputeTotalPrice() {
return computeTotalPrice;
}
public void setComputeTotalPrice(BigDecimal computeTotalPrice) {
this.computeTotalPrice = computeTotalPrice;
}
public BigDecimal getComputeUnitPrice() {
return computeUnitPrice;
}
public void setComputeUnitPrice(BigDecimal computeUnitPrice) {
this.computeUnitPrice = computeUnitPrice;
}
public BigDecimal getRefTotalPrice() {
return refTotalPrice;
}
public void setRefTotalPrice(BigDecimal refTotalPrice) {
this.refTotalPrice = refTotalPrice;
}
public BigDecimal getRefUnitPrice() {
return refUnitPrice;
}
public void setRefUnitPrice(BigDecimal refUnitPrice) {
this.refUnitPrice = refUnitPrice;
}
public String getCleanCurrentFloorDesc() {
return cleanCurrentFloorDesc;
}
public void setCleanCurrentFloorDesc(String cleanCurrentFloorDesc) {
this.cleanCurrentFloorDesc = cleanCurrentFloorDesc;
}
/**
* 构造caseId
*
* @return
* @throws NoSuchAlgorithmException
*/
public String generateCaseId() {
String text = getCaseCountyName() + getCaseAddress() + getCaseArea();
if (null != getCaseSigningDate())
text += simplaDateFormat.format(getCaseSigningDate());
return DigestUtils.md5DigestAsHex(text.getBytes());
}
public String refinePropertyType() {
String houseType = getCaseHouseType();
if (StringUtils.isEmpty(houseType)) return "其他";
// 不包含
boolean exists = juzhu.stream().filter(x -> x.equals(houseType)).findAny().isPresent();
if (!exists)
return "居住";
exists = bangong.stream().filter(x -> x.equals(houseType)).findAny().isPresent();
if (!exists)
return "办公";
exists = shangye.stream().filter(x -> x.equals(houseType)).findAny().isPresent();
if (!exists)
return "商业";
return "其他";
}
/**
* 从室号中提取所在层
*
* @return
*/
public Integer refineCurrentFloor() {
if (StringUtils.isEmpty(getCaseAddress())) return null;
Pattern pattern = Pattern.compile("(\\d+)(室)$");
Matcher matcher = pattern.matcher(getCaseAddress());
if (!matcher.find()) return null;
String value = matcher.group(1);
Integer num = new Integer(value);
if (num > 1000 || num > 100)
return num / 100;
return null;
}
/**
* 获取楼栋地址
* 1. 去掉abc室
* 2. 去掉末尾是数字的
*
* @return
*/
public String refineBuildingAddress() {
if (StringUtils.isEmpty(getCaseAddress())) return null;
Pattern pattern = Pattern.compile("(\\d+)室$");
Matcher matcher = pattern.matcher(getCaseAddress());
if (matcher.find()) {
return getCaseAddress().replace(matcher.group(0), "");
}
pattern = Pattern.compile("(\\d+)$");
matcher = pattern.matcher(getCaseAddress());
if (matcher.find()) {
return getCaseAddress().replace(matcher.group(0), "");
}
return null;
}
}

View File

@ -0,0 +1,803 @@
package com.ruoyi.project.data.cases.domain;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.util.DigestUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class OriginalResidenceSaleOpeningCase {
// 东南, 西南, 西北, 东北, , , 西,
private static String[] towardArray = new String[]{"东南", "西南", "西北", "东北", "", "", "西", ""};
private Integer yearMonth;
/**
* 案例ID 唯一
*/
private String caseId;
/**
* 链家案例id
*/
private String caseLianJiaId;
/**
* 链家小区编码
*/
private String caseLianJiaCommunityId;
/**
* 房源标题
*/
private String caseTitle;
/**
* 物业类型
*/
private String cleanPropertyType;
/**
* 户型
*/
private String caseApartmentLayout;
/**
* 房屋结构
*/
private String caseHouseStructure;
/**
* 建筑面积
*/
private BigDecimal caseArea;
/**
* 地下面积
*/
private BigDecimal caseUndergroundArea;
/**
* 朝向
*/
private String caseToward;
/**
* 朝向
*/
private String cleanToward;
/**
* 楼层
*/
private String caseStorey;
/**
* 总层
*/
private Integer cleanTotalFloor;
/**
* 所在层
*/
private String cleanCurrentFloorDesc;
/**
* 上架日期
*/
private Date caseUpDate;
/**
* 下架日期
*/
private Date caseDownDate;
/**
* 有无电梯
*/
private String caseElevator;
/**
* 有无电梯
*/
private Boolean cleanElevator;
/**
* 电梯梯户
*/
private String caseTiHu;
/**
* 装修
*/
private String caseDecoration;
/**
* 装修
*/
private String cleanDecoration;
/**
* 竣工年
*/
private String caseYear;
/**
* 竣工年
*/
private Integer cleanYear;
/**
* 地址
*/
private String caseAddress;
/**
*
*/
private String vid;
/**
* 产权性质
*/
private String caseChanQuanXingZhi;
/**
* 售价
*/
private BigDecimal casePrice;
/**
* 总价
*/
private BigDecimal cleanTotalPrice;
/**
* 单价
*/
private BigDecimal cleanUnitPrice;
/**
* 小区名称
*/
private String caseCommunityName;
/**
* 累计带看
*/
private Integer caseVisitedNum;
/**
* 首次带看日
*/
private Date caseFirstVisitTime;
/**
* 最近带看日
*/
private Date caseLatestVisitTime;
/**
* 近15日带看
*/
private Integer caseVisitedNum15;
/**
* 近30天带看
*/
private Integer caseVisitedNum30;
/**
* 案例URL
*/
private String caseUrl;
/**
* 小区URL
*/
private String caseCommunityUrl;
/**
* 抓取日期
*/
private Date caseGetDate;
/**
* 抓取网站名
*/
private String caseProvider;
/**
* 小区名称-系统
*/
private String uvCommunityName;
/**
* 小区地址-系统
*/
private String uvCommunityAddress;
/**
* 区域
*/
private String uvCounty;
/**
* 板块
*/
private String uvBlock;
/**
* 环线
*/
private String uvLoop;
/**
* 面积系数
*/
private BigDecimal areaCoefficient;
/**
* 朝向系数
*/
private BigDecimal towardCoefficient;
/**
* 楼层系数
*/
private BigDecimal floorCoefficient;
/**
* 建成年代系数
*/
private BigDecimal yearCoefficient;
/**
* 楼栋系数
*/
private BigDecimal buildingCoefficient;
/**
* 最终成交日期
*/
private Date caseLastDeal;
/**
*
*/
private String newCaseId;
public static String[] getTowardArray() {
return towardArray;
}
public static void setTowardArray(String[] towardArray) {
OriginalResidenceSaleOpeningCase.towardArray = towardArray;
}
public String getCaseId() {
return caseId;
}
public void setCaseId(String caseId) {
this.caseId = caseId;
}
public String getCaseLianJiaId() {
return caseLianJiaId;
}
public void setCaseLianJiaId(String caseLianJiaId) {
this.caseLianJiaId = caseLianJiaId;
}
public String getCaseLianJiaCommunityId() {
return caseLianJiaCommunityId;
}
public void setCaseLianJiaCommunityId(String caseLianJiaCommunityId) {
this.caseLianJiaCommunityId = caseLianJiaCommunityId;
}
public String getCaseTitle() {
return caseTitle;
}
public void setCaseTitle(String caseTitle) {
this.caseTitle = caseTitle;
}
public String getCleanPropertyType() {
return cleanPropertyType;
}
public void setCleanPropertyType(String cleanPropertyType) {
this.cleanPropertyType = cleanPropertyType;
}
public String getCaseApartmentLayout() {
return caseApartmentLayout;
}
public void setCaseApartmentLayout(String caseApartmentLayout) {
this.caseApartmentLayout = caseApartmentLayout;
}
public String getCaseHouseStructure() {
return caseHouseStructure;
}
public void setCaseHouseStructure(String caseHouseStructure) {
this.caseHouseStructure = caseHouseStructure;
}
public BigDecimal getCaseArea() {
return caseArea;
}
public void setCaseArea(BigDecimal caseArea) {
this.caseArea = caseArea;
}
public BigDecimal getCaseUndergroundArea() {
return caseUndergroundArea;
}
public void setCaseUndergroundArea(BigDecimal caseUndergroundArea) {
this.caseUndergroundArea = caseUndergroundArea;
}
public String getCaseToward() {
return caseToward;
}
public void setCaseToward(String caseToward) {
this.caseToward = caseToward;
}
public String getCleanToward() {
return cleanToward;
}
public void setCleanToward(String cleanToward) {
this.cleanToward = cleanToward;
}
public String getCaseStorey() {
return caseStorey;
}
public void setCaseStorey(String caseStorey) {
this.caseStorey = caseStorey;
}
public Integer getCleanTotalFloor() {
return cleanTotalFloor;
}
public void setCleanTotalFloor(Integer cleanTotalFloor) {
this.cleanTotalFloor = cleanTotalFloor;
}
public String getCleanCurrentFloorDesc() {
return cleanCurrentFloorDesc;
}
public void setCleanCurrentFloorDesc(String cleanCurrentFloorDesc) {
this.cleanCurrentFloorDesc = cleanCurrentFloorDesc;
}
public Date getCaseUpDate() {
return caseUpDate;
}
public void setCaseUpDate(Date caseUpDate) {
this.caseUpDate = caseUpDate;
}
public Date getCaseDownDate() {
return caseDownDate;
}
public void setCaseDownDate(Date caseDownDate) {
this.caseDownDate = caseDownDate;
}
public String getCaseElevator() {
return caseElevator;
}
public void setCaseElevator(String caseElevator) {
this.caseElevator = caseElevator;
}
public Boolean getCleanElevator() {
return cleanElevator;
}
public void setCleanElevator(Boolean cleanElevator) {
this.cleanElevator = cleanElevator;
}
public String getCaseTiHu() {
return caseTiHu;
}
public void setCaseTiHu(String caseTiHu) {
this.caseTiHu = caseTiHu;
}
public String getCaseDecoration() {
return caseDecoration;
}
public void setCaseDecoration(String caseDecoration) {
this.caseDecoration = caseDecoration;
}
public String getCleanDecoration() {
return cleanDecoration;
}
public void setCleanDecoration(String cleanDecoration) {
this.cleanDecoration = cleanDecoration;
}
public String getCaseYear() {
return caseYear;
}
public void setCaseYear(String caseYear) {
this.caseYear = caseYear;
}
public Integer getCleanYear() {
return cleanYear;
}
public void setCleanYear(Integer cleanYear) {
this.cleanYear = cleanYear;
}
public String getCaseAddress() {
return caseAddress;
}
public void setCaseAddress(String caseAddress) {
this.caseAddress = caseAddress;
}
public String getVid() {
return vid;
}
public void setVid(String vid) {
this.vid = vid;
}
public String getCaseChanQuanXingZhi() {
return caseChanQuanXingZhi;
}
public void setCaseChanQuanXingZhi(String caseChanQuanXingZhi) {
this.caseChanQuanXingZhi = caseChanQuanXingZhi;
}
public BigDecimal getCasePrice() {
return casePrice;
}
public void setCasePrice(BigDecimal casePrice) {
this.casePrice = casePrice;
}
public BigDecimal getCleanTotalPrice() {
return cleanTotalPrice;
}
public void setCleanTotalPrice(BigDecimal cleanTotalPrice) {
this.cleanTotalPrice = cleanTotalPrice;
}
public BigDecimal getCleanUnitPrice() {
return cleanUnitPrice;
}
public void setCleanUnitPrice(BigDecimal cleanUnitPrice) {
this.cleanUnitPrice = cleanUnitPrice;
}
public String getCaseCommunityName() {
return caseCommunityName;
}
public void setCaseCommunityName(String caseCommunityName) {
this.caseCommunityName = caseCommunityName;
}
public Integer getCaseVisitedNum() {
return caseVisitedNum;
}
public void setCaseVisitedNum(Integer caseVisitedNum) {
this.caseVisitedNum = caseVisitedNum;
}
public Date getCaseFirstVisitTime() {
return caseFirstVisitTime;
}
public void setCaseFirstVisitTime(Date caseFirstVisitTime) {
this.caseFirstVisitTime = caseFirstVisitTime;
}
public Date getCaseLatestVisitTime() {
return caseLatestVisitTime;
}
public void setCaseLatestVisitTime(Date caseLatestVisitTime) {
this.caseLatestVisitTime = caseLatestVisitTime;
}
public Integer getCaseVisitedNum15() {
return caseVisitedNum15;
}
public void setCaseVisitedNum15(Integer caseVisitedNum15) {
this.caseVisitedNum15 = caseVisitedNum15;
}
public Integer getCaseVisitedNum30() {
return caseVisitedNum30;
}
public void setCaseVisitedNum30(Integer caseVisitedNum30) {
this.caseVisitedNum30 = caseVisitedNum30;
}
public String getCaseUrl() {
return caseUrl;
}
public void setCaseUrl(String caseUrl) {
this.caseUrl = caseUrl;
}
public String getCaseCommunityUrl() {
return caseCommunityUrl;
}
public void setCaseCommunityUrl(String caseCommunityUrl) {
this.caseCommunityUrl = caseCommunityUrl;
}
public Date getCaseGetDate() {
return caseGetDate;
}
public void setCaseGetDate(Date caseGetDate) {
this.caseGetDate = caseGetDate;
}
public String getCaseProvider() {
return caseProvider;
}
public void setCaseProvider(String caseProvider) {
this.caseProvider = caseProvider;
}
public String getUvCommunityName() {
return uvCommunityName;
}
public void setUvCommunityName(String uvCommunityName) {
this.uvCommunityName = uvCommunityName;
}
public String getUvCommunityAddress() {
return uvCommunityAddress;
}
public void setUvCommunityAddress(String uvCommunityAddress) {
this.uvCommunityAddress = uvCommunityAddress;
}
public String getUvCounty() {
return uvCounty;
}
public void setUvCounty(String uvCounty) {
this.uvCounty = uvCounty;
}
public String getUvBlock() {
return uvBlock;
}
public void setUvBlock(String uvBlock) {
this.uvBlock = uvBlock;
}
public String getUvLoop() {
return uvLoop;
}
public void setUvLoop(String uvLoop) {
this.uvLoop = uvLoop;
}
public BigDecimal getAreaCoefficient() {
return areaCoefficient;
}
public void setAreaCoefficient(BigDecimal areaCoefficient) {
this.areaCoefficient = areaCoefficient;
}
public BigDecimal getTowardCoefficient() {
return towardCoefficient;
}
public void setTowardCoefficient(BigDecimal towardCoefficient) {
this.towardCoefficient = towardCoefficient;
}
public BigDecimal getFloorCoefficient() {
return floorCoefficient;
}
public void setFloorCoefficient(BigDecimal floorCoefficient) {
this.floorCoefficient = floorCoefficient;
}
public BigDecimal getYearCoefficient() {
return yearCoefficient;
}
public void setYearCoefficient(BigDecimal yearCoefficient) {
this.yearCoefficient = yearCoefficient;
}
public BigDecimal getBuildingCoefficient() {
return buildingCoefficient;
}
public void setBuildingCoefficient(BigDecimal buildingCoefficient) {
this.buildingCoefficient = buildingCoefficient;
}
public Date getCaseLastDeal() {
return caseLastDeal;
}
public void setCaseLastDeal(Date caseLastDeal) {
this.caseLastDeal = caseLastDeal;
}
public void setNewCaseId(String newCaseId) {
this.newCaseId = newCaseId;
}
/**
* 生成caseid根据caseid来确定唯一案例还有案例来源
*
* @return
*/
public String getNewCaseId() {
return DigestUtils.md5DigestAsHex(getCaseLianJiaId().getBytes());
}
public Integer getYearMonth() {
return yearMonth;
}
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
}
public void clear() {
clearPrice();
clearElevator();
clearDecoration();
clearFloor();
clearToward();
clearYear();
}
private void clearYear() {
setCleanYear(new Integer(getCaseYear()));
}
private void clearPrice() {
try {
// 总价
setCleanTotalPrice(getCasePrice().multiply(new BigDecimal(10 * 1000)));
// 单价
setCleanUnitPrice(getCleanTotalPrice().divide(getCaseArea(), 2));
} catch (Exception e) {
}
}
// 装修
private void clearDecoration() {
if (StringUtils.isNotNull(getCaseDecoration())) {
if (!"其他".equals(getCaseDecoration())) {
setCleanDecoration(getCaseDecoration());
}
}
}
// 电梯
private void clearElevator() {
if (StringUtils.isNotNull(getCaseElevator())) {
if ("".equals(getCaseElevator())) {
setCleanElevator(true);
} else if ("".equals(getCaseElevator())) {
setCleanElevator(false);
}
}
}
// 楼层
private void clearFloor() {
if (StringUtils.isNotNull(getCaseStorey())) {
Pattern pattern = Pattern.compile("([高中低])楼层 \\(共(\\d+)层\\)");
Matcher matcher = pattern.matcher(getCaseStorey());
if (matcher.find()) {
String currentFloor = matcher.group(1);
String totalFloor = matcher.group(2);
setCleanTotalFloor(new Integer(totalFloor));
if ("".equals(currentFloor)) {
setCleanCurrentFloorDesc("高区");
} else if ("".equals(currentFloor)) {
setCleanCurrentFloorDesc("中区");
} else if ("".equals(currentFloor)) {
setCleanCurrentFloorDesc("低区");
}
} else {
pattern = Pattern.compile("地下室 \\(共(\\d+)层\\)");
matcher = pattern.matcher(getCaseStorey());
if (matcher.find()) {
String totalFloor = matcher.group(1);
setCleanTotalFloor(new Integer(totalFloor));
}
}
}
}
private void clearToward() {
// 排序规则
String[] segments = this.getCaseToward().split(" ");
String cleanTag = segments[0].trim();
if (1 == segments.length) {
if (!"".equals(cleanTag) && !"暂无数据".equals(cleanTag)) {
this.setCleanToward(cleanTag);
}
} else {
// 排序规则
int index = towardArray.length;
for (int j = 0; j < towardArray.length; j++) {
for (String seg : segments) {
if (seg.equals(towardArray[j])) {
if (j < index)
index = j;
}
}
}
this.setCleanToward(towardArray[index]);
}
}
@Override
public String toString() {
return "OriginalResidenceOpeningCase{" +
"yearMonth=" + yearMonth +
", caseId='" + caseId + '\'' +
", caseLianJiaId='" + caseLianJiaId + '\'' +
", caseLianJiaCommunityId='" + caseLianJiaCommunityId + '\'' +
", caseTitle='" + caseTitle + '\'' +
", cleanPropertyType='" + cleanPropertyType + '\'' +
", caseApartmentLayout='" + caseApartmentLayout + '\'' +
", caseHouseStructure='" + caseHouseStructure + '\'' +
", caseArea=" + caseArea +
", caseUndergroundArea=" + caseUndergroundArea +
", caseToward='" + caseToward + '\'' +
", cleanToward='" + cleanToward + '\'' +
", caseStorey='" + caseStorey + '\'' +
", cleanTotalFloor=" + cleanTotalFloor +
", cleanCurrentFloorDesc='" + cleanCurrentFloorDesc + '\'' +
", caseUpDate=" + caseUpDate +
", caseDownDate=" + caseDownDate +
", caseElevator='" + caseElevator + '\'' +
", cleanElevator=" + cleanElevator +
", caseTiHu='" + caseTiHu + '\'' +
", caseDecoration='" + caseDecoration + '\'' +
", cleanDecoration='" + cleanDecoration + '\'' +
", caseYear='" + caseYear + '\'' +
", cleanYear=" + cleanYear +
", caseAddress='" + caseAddress + '\'' +
", vid='" + vid + '\'' +
", caseChanQuanXingZhi='" + caseChanQuanXingZhi + '\'' +
", casePrice=" + casePrice +
", cleanTotalPrice=" + cleanTotalPrice +
", cleanUnitPrice=" + cleanUnitPrice +
", caseCommunityName='" + caseCommunityName + '\'' +
", caseVisitedNum=" + caseVisitedNum +
", caseFirstVisitTime=" + caseFirstVisitTime +
", caseLatestVisitTime=" + caseLatestVisitTime +
", caseVisitedNum15=" + caseVisitedNum15 +
", caseVisitedNum30=" + caseVisitedNum30 +
", caseUrl='" + caseUrl + '\'' +
", caseCommunityUrl='" + caseCommunityUrl + '\'' +
", caseGetDate=" + caseGetDate +
", caseProvider='" + caseProvider + '\'' +
", uvCommunityName='" + uvCommunityName + '\'' +
", uvCommunityAddress='" + uvCommunityAddress + '\'' +
", uvCounty='" + uvCounty + '\'' +
", uvBlock='" + uvBlock + '\'' +
", uvLoop='" + uvLoop + '\'' +
", areaCoefficient=" + areaCoefficient +
", towardCoefficient=" + towardCoefficient +
", floorCoefficient=" + floorCoefficient +
", yearCoefficient=" + yearCoefficient +
", buildingCoefficient=" + buildingCoefficient +
", caseLastDeal=" + caseLastDeal +
", newCaseId='" + newCaseId + '\'' +
'}';
}
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.project.data.cases.domain;
public class OriginalResidenceSaleOpeningCaseQueryModel extends OriginalResidenceSaleOpeningCase {
private Integer pageIndex;
private Integer pageSize;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -0,0 +1,41 @@
package com.ruoyi.project.data.cases.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("compute")
public interface OriginalResidenceSaleClosingCaseMapper {
/**
* 创建表
*
* @param yearMonth
* @return
*/
int createTable(@Param("yearMonth") Integer yearMonth);
/**
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
* @param yearMonth
* @return
*/
int createCleanTable(@Param("yearMonth") Integer yearMonth);
/**
* 分页总数
*
* @param originalResidenceSaleOpeningCase
* @return
*/
Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
/**
* @param queryModel
* @return
*/
List<OriginalResidenceSaleOpeningCase> pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel);
}

View File

@ -0,0 +1,50 @@
package com.ruoyi.project.data.cases.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("compute")
public interface OriginalResidenceSaleOpeningCaseMapper {
/**
* 创建表
*
* @param yearMonth
* @return
*/
int createTable(@Param("yearMonth") Integer yearMonth);
/**
* 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM
*
* @param yearMonth
* @return
*/
int createCleanTable(@Param("yearMonth") Integer yearMonth);
/**
* 案例汇总表挂牌成交
*
* @param yearMonth
* @return
*/
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
/**
* 分页总数
*
* @param originalResidenceSaleOpeningCase
* @return
*/
Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
/**
* @param queryModel
* @return
*/
List<OriginalResidenceSaleOpeningCase> pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel);
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.project.data.cases.mapper.sync;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("calc")
public interface DownloadOriginalResidenceSaleClosingCaseMapper {
/**
* @return
*/
List<OriginalResidenceSaleClosingCase> download(@Param("yearMonth") Integer yearMonth);
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.project.data.cases.mapper.sync;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import java.util.List;
@DS("oldProd")
public interface DownloadOriginalResidenceSaleOpeningCaseMapper {
/**
* @return
*/
List<OriginalResidenceSaleOpeningCase> download();
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.project.data.cases.mapper.sync;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import org.apache.ibatis.annotations.Param;
@DS("calc")
public interface SyncOriginalResidenceSaleOpeningCaseMapper {
/**
* 创建挂牌案例表
* @param yearMonth
*/
int createTable(@Param("yearMonth") Integer yearMonth);
/**
*
* @param originalResidenceSaleOpeningCase
* @return
*/
int insert(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase);
}

View File

@ -0,0 +1,5 @@
package com.ruoyi.project.data.cases.service;
public interface IOriginalResidenceSaleClosingCaseService {
void pullData();
}

View File

@ -0,0 +1,5 @@
package com.ruoyi.project.data.cases.service;
public interface IOriginalResidenceSaleOpeningCaseService {
void pullData();
}

View File

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

View File

@ -0,0 +1,122 @@
package com.ruoyi.project.data.cases.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Service
@DS("compute")
public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService {
private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class);
@Autowired
private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper;
@Autowired
private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper;
@Autowired
private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper;
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
private JdbcTemplate jdbcTemplate;
/**
*
*/
@Scheduled(cron = "0 0 5 25 * ?")
@Override
public void pullData() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
Integer syncTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)));
Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
prepare(computeTableRoute, syncTableRoute);
List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download();
list.parallelStream().forEach(originalResidenceOpeningCase -> {
originalResidenceOpeningCase.clear();
originalResidenceOpeningCase.setYearMonth(syncTableRoute);
// logger.debug(originalResidenceOpeningCase.toString());
syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase);
});
running(computeTableRoute, syncTableRoute, list);
after(computeTableRoute, lastYearMonth);
}
/**
* 准备工作 创建表
*
* @param computeTableRoute
* @param syncTableRoute
*/
public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
originalResidenceSaleOpeningCaseMapper.createTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute);
syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
}
/**
* 批量入库
*
* @param computeTableRoute
* @param list
*/
public void running(Integer computeTableRoute, Integer syncTableRoute, List<OriginalResidenceSaleOpeningCase> list) {
SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
".original_residence_sale_opening_case_" + computeTableRoute + "(case_id, case_lianjia_id, " +
"case_lianjia_community_id, case_title, clean_property_type, case_apartment_layout, " +
"case_house_structure, case_area, case_underground_area, case_toward, clean_toward, " +
"case_storey, clean_total_floor, clean_current_floor_desc, case_elevator, clean_elevator, " +
"case_tihu, case_decoration, clean_decoration, case_year, clean_year, case_address, " +
"case_price, clean_unit_price, clean_total_price, case_community_name, case_visited_num, " +
"case_visited_num_15, case_visited_num_30, case_latest_deal_date, case_latest_visited_date, " +
"case_first_visited_date, case_url, case_community_url, case_get_date, case_provider, " +
"create_time) values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," +
":cleanPropertyType," +
":caseApartmentLayout,:caseHouseStructure,:caseArea,:caseUndergroundArea,:caseToward," +
":cleanToward,:caseStorey,:cleanTotalFloor,:cleanCurrentFloorDesc,:caseElevator," +
":cleanElevator,:caseTiHu,:caseDecoration,:cleanDecoration,:caseYear,:cleanYear,:caseAddress," +
":casePrice,:cleanUnitPrice,:cleanTotalPrice,:caseCommunityName,:caseVisitedNum," +
":caseVisitedNum15,:caseVisitedNum30,NULL,:caseLatestVisitTime,:caseFirstVisitTime,:caseUrl," +
":caseCommunityUrl,:caseGetDate,:caseProvider,GETDATE());",
batchParams);
}
/**
* 匹配数据
*
* @param yearMonth
*/
public void after(Integer yearMonth, Integer lastYearMonth) {
// 清洗挂牌案例
String rawSql = LoadUtil.loadContent("sql-template/clear_opening_case.sql");
String sql = rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString());
jdbcTemplate.update(sql);
// 作价
}
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.project.data.price.controller;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.data.basis.domain.UVBasePrice;
import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel;
import com.ruoyi.project.data.basis.service.IUVBasePriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/data/base/price")
public class BasePriceController extends BaseController {
@Autowired
private IUVBasePriceService basePriceService;
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(UVBasePriceQueryModel queryModel) {
int pageIndex = ServletUtils.getParameterToInt(TableSupport.PAGE_NUM);
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
queryModel.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
queryModel.setPageSize(pageSize);
int total = basePriceService.pageCount(queryModel);
List<UVBasePrice> list = basePriceService.pageList(queryModel);
return getDataTable(list, total);
}
}

View File

@ -1,4 +1,17 @@
package com.ruoyi.project.data.price.controller;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
public class ComputeResidenceSaleBasePriceController {
}

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleClosingCaseMapper">
<resultMap id="resultMapping" type="com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase">
<result property="caseCountyName" column="区域"/>
<result property="caseBlockName" column="板块"/>
<result property="caseLoopName" column="环线"/>
<result property="caseCommunityName" column="小区名称"/>
<result property="caseAddress" column="房屋地址"/>
<result property="caseArea" column="面积" javaType="java.math.BigDecimal"/>
<result property="caseHouseType" column="房屋类型"/>
<result property="caseTotalPrice" column="总价" javaType="java.math.BigDecimal"/>
<result property="caseUnitPrice" column="单价" javaType="java.math.BigDecimal"/>
<result property="caseRegisterDate" column="登记日期" javaType="java.sql.Date"/>
<result property="caseSigningDate" column="签约日期" javaType="java.sql.Date"/>
<result property="agencyName" column="中介公司"/>
<result property="agencyType" column="中介类型"/>
<result property="sellerType" column="卖家类型"/>
<result property="buyerType" column="买家类型"/>
<result property="birthday" column="出生年月日" javaType="java.sql.Date"/>
<!-- 成交类型(二手)-->
<result property="cleanCaseType" column="cleanCaseType"/>
</resultMap>
<select id="download" parameterType="int" resultMap="resultMapping">
select
区域
,板块
,环线
,小区名称
,房屋地址
,面积
,房屋类型
,总价
,单价
,登记日期
,签约日期
,中介公司
,中介类型
,卖家类型
,买家类型
,出生年月日
, 2 as cleanCaseType
from dbo.二手房成交数据${yearMonth};
</select>
</mapper>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper">
<resultMap id="resultMapping" type="com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase">
<result property="caseLianJiaId" column="llid"/>
<result property="caseLianJiaCommunityId" column="lcid"/>
<result property="caseTitle" column="name"/>
<result property="caseApartmentLayout" column="roomtype"/>
<result property="caseArea" column="area" javaType="java.math.BigDecimal"/>
<result property="caseToward" column="towards"/>
<result property="caseStorey" column="storey"/>
<result property="caseLastDeal" column="lastDeal" javaType="java.sql.Date"/>
<result property="caseElevator" column="condoElev"/>
<result property="caseDecoration" column="decoration"/>
<result property="caseYear" column="year"/>
<result property="caseAddress" column="address"/>
<result property="casePrice" column="price" javaType="java.math.BigDecimal"/>
<result property="caseCommunityName" column="cname"/>
<result property="caseVisitedNum" column="visited_num"/>
<result property="caseFirstVisitTime" column="first_visit_time" javaType="java.sql.Date"/>
<result property="caseVisitedNum15" column="visited_num_15"/>
<result property="caseVisitedNum30" column="visited_num_30"/>
<result property="caseUrl" column="url"/>
<result property="caseCommunityUrl" column="curl"/>
<result property="caseGetDate" column="getCaseTime" javaType="java.sql.Date"/>
<result property="caseProvider" column="caseProvider"/>
</resultMap>
<select id="download" resultMap="resultMapping">
select llid
, lcid
, name
, type
, roomtype
, area
, towards
, storey
, lastDeal
, dealToNow
, condoElev
, decoration
, year
, address
, vid
, dataType
, price
, cname
, visited_num
, first_visit_time
, visited_num_15
, visited_num_30
, url
, curl
, getCaseTime
, '链家' as caseProvider
from dbo.Listing_Lianjia;
</select>
</mapper>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper">
<!-- 外部数据重复问题 -->
<update id="createTable">
<bind name="targetTableName" value="'dbo.original_residence_sale_closing_case_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
CREATE TABLE ${targetTableName}
(
id bigint identity (1,1) not null primary key,
case_id varchar(32) not null,
case_county_name nvarchar(20) null,
case_block_name nvarchar(20) null,
case_loopline_name nvarchar(20) null,
case_community_name nvarchar(200) null,
case_address nvarchar(500) not null,
case_area decimal(18, 2) not null,
case_unit_price decimal(18, 2) not null,
case_total_price decimal(18, 2) not null,
case_house_type nvarchar(20) null,
case_signing_date date null,
case_register_date date null,
case_current_floor int null,
case_house_property nvarchar(20) null,
case_apartment_layout nvarchar(20) null,
case_compute_unit_price decimal(18, 2) null,
case_compute_total_price decimal(18, 2) null,
case_ref_unit_price decimal(18, 2) null,
case_ref_total_price decimal(18, 2) null,
case_agency_name nvarchar(200) null,
case_agency_type nvarchar(50) null,
case_seller_type nvarchar(20) null,
case_buyer_type nvarchar(20) null,
case_birthday date null,
case_deal_type int not null,
clean_condo_id nvarchar(20) null,
clean_building_id nvarchar(20) null,
clean_community_id nvarchar(20) null,
clean_condo_address nvarchar(500) null,
clean_property_type nvarchar(20) not null,
create_time datetime not null,
clean_current_floor int null,
clean_building_address nvarchar(200) null
);
</update>
<update id="createCleanTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASE_DEAL_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
CREATE TABLE ${targetTableName}
(
SID int NOT NULL IDENTITY(1, 1) ,
case_id varchar(32) not null,
ProjectID bigint NULL,
BuildingID bigint NULL,
Area decimal (18, 2) NULL,
UpperFloorSum nvarchar (32) null,
UpperFloorNum nvarchar (32) NULL,
AreaCoff decimal (7, 4) NULL,
FloorCoff decimal (7, 4) NULL,
BuildingCoff decimal (7, 4) NULL,
PriceTotal decimal (18, 2) NOT NULL,
PriceUnit decimal (18, 2) NOT NULL,
PriceUnitAdj decimal (18, 2) NOT NULL,
DateContract date NULL
);
</update>
</mapper>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper">
<update id="createTable">
<bind name="targetTableName" value="'dbo.original_residence_sale_opening_case_' + yearMonth" />
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
CREATE TABLE ${targetTableName}
(
case_id varchar (32) NOT NULL,
case_lianjia_id nvarchar (50) NOT null primary key,
case_lianjia_community_id nvarchar (50) NOT NULL,
case_title nvarchar (500) NOT NULL,
clean_property_type nvarchar (20) NULL,
case_apartment_layout nvarchar (500) NOT NULL,
case_house_structure nvarchar (50) NULL,
case_area decimal (10, 2) NOT NULL,
case_underground_area decimal (10, 2) NULL,
case_toward nvarchar (50) NOT NULL,
clean_toward nvarchar (50) NULL,
case_storey nvarchar (20) NOT NULL,
clean_total_floor int NOT NULL,
clean_current_floor_desc nvarchar (20) NULL,
case_elevator nvarchar (20) NULL,
clean_elevator nvarchar (20) NULL,
case_tihu nvarchar (20) NULL,
case_decoration nvarchar (20) NULL,
clean_decoration nvarchar (50) NULL,
case_year int NOT NULL,
clean_year int NOT NULL,
case_address nvarchar (500) NULL,
case_vid nvarchar (500) NULL,
case_chan_quan_xing_zhi nvarchar (200) NULL,
case_price decimal (18, 2) NOT NULL,
clean_unit_price decimal (18, 2) NOT NULL,
clean_total_price decimal (18, 2) NOT NULL,
case_community_name nvarchar (500) NULL,
case_visited_num int NOT NULL,
case_visited_num_15 int NOT NULL,
case_visited_num_30 int NOT NULL,
case_latest_deal_date date NULL,
case_latest_visited_date date NULL,
case_first_visited_date date NULL,
case_url nvarchar (500) NOT NULL,
case_community_url nvarchar (500) NOT NULL,
case_get_date date NOT NULL,
case_provider nvarchar (50) NOT NULL,
uv_community_name nvarchar (500) NULL,
uv_community_address nvarchar (1024) NULL,
uv_community_id nvarchar (20) NULL,
uv_building_id nvarchar (20) NULL,
uv_county nvarchar (50) NULL,
uv_block nvarchar (50) NULL,
uv_loop nvarchar (50) NULL,
area_coefficient decimal (18, 6) NULL,
toward_coefficient decimal (18, 6) NULL,
floor_coefficient decimal (18, 6) NULL,
decoration_coefficient int NULL,
year_coefficient decimal (18, 6) NULL,
building_coefficient decimal (18, 6) NULL,
adjust_unit_price decimal (18, 2) NULL,
clean_project_level nvarchar (50) NULL,
create_time datetime NOT NULL
);
</update>
<update id="createCleanTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth" />
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
CREATE TABLE ${targetTableName}
(
case_id varchar(32) not null,
HouseholdsID_LJ bigint not null primary key,
ProjectID_LJ bigint null,
ProjectID bigint null,
Roomtype nvarchar(64) null,
Area decimal(18, 2) null,
Towards nvarchar(64) null,
UpperFloorSum nvarchar(32) null,
UpperFloorNum nvarchar(32) null,
Elevator tinyint null,
Decoration nvarchar(64) null,
Year int null,
AreaCoff decimal(7, 4) null,
TowardsCoff decimal(7, 4) null,
FloorCoff decimal(7, 4) null,
DecorationRng int null,
YearCoff decimal(7, 4) null,
BuildingCoff decimal(7, 4) null,
PriceTotal decimal(18, 2) null,
PriceUnit decimal(18, 2) not null,
PriceUnitAdj decimal(18, 2) not null,
Visited_Num int null,
First_Visit_Time date null,
Visited_Num_15 int null,
Visited_Num_30 int null,
Status tinyint null,
AdjustedValue decimal(18, 2) null,
AdjustedPst decimal(18, 6) null,
AdjustedCumValue decimal(18, 2) null,
AdjustedCumPst decimal(18, 6) null,
AdjustedCumValueAbs decimal(18, 2) null,
AdjustedCumPstAbs decimal(18, 6) null,
AdjustedCumNum int null,
PriceTotalIn decimal(18, 2) null,
PriceTotalOut decimal(18, 2) null,
PriceDateIn date null,
PriceDateOut date null
);
</update>
<update id="createAssembleTable">
<bind name="targetTableName" value="'dbo.DW_HOUSINGCASE_COMM_' + yearMonth" />
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
create table ${targetTableName}
(
SID int primary key identity
, case_id varchar(32) not null
, HouseholdsID_LJ bigint
, ProjectID_LJ bigint
, ProjectID bigint --modified
, ProjectName nvarchar(1024)
, ProjectAddr nvarchar(1024)
, County nvarchar(512)
, Block nvarchar(512)
, Loop nvarchar(512)
, Roomtype nvarchar(64)
, Area decimal(18, 2)
, Towards nvarchar(64)
, UpperFloorSum nvarchar(32)
, UpperFloorNum nvarchar(32)
, Elevator tinyint
, Decoration nvarchar(64)
, Year int
, AreaCoff decimal(7, 4)
, TowardsCoff decimal(7, 4)
, FloorCoff decimal(7, 4)
, DecorationRng int
, YearCoff decimal(7, 4)
, BuildingCoff decimal(7, 4)
, BasePrice_1 decimal(18, 2)
, PriceTotal decimal(18, 2) not null
, PriceUnit decimal(18, 2) not null
, PriceUnitAdj decimal(18, 2) not null
, Visited_Num int
, First_Visit_Time date
, Visited_Num_15 int
, Visited_Num_30 int
, Status tinyint
, AdjustedValue decimal(18, 2)
, AdjustedPst decimal(18, 6)
, AdjustedCumValue decimal(18, 2)
, AdjustedCumPst decimal(18, 6)
, AdjustedCumValueAbs decimal(18, 2)
, AdjustedCumPstAbs decimal(18, 6)
, AdjustedCumNum int
, PriceTotalIn decimal(18, 2)
, PriceDateIn date
);
</update>
</mapper>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper">
<update id="createTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth + '_RAW'"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NULL
CREATE TABLE ${targetTableName}
(
SID int NOT NULL IDENTITY(1, 1) primary key,
llid bigint NULL,
lcid bigint NULL,
Name nvarchar (1024) NULL,
Roomtype nvarchar (50) NULL,
Area decimal (18, 2) NULL,
Towards nvarchar (50) NULL,
Storey nvarchar (50) NULL,
Lastdeal date NULL,
Condoelev nvarchar (50) NULL,
Decoration nvarchar (50) NULL,
Year int NULL,
Address nvarchar (1024) NULL,
Price decimal (18, 2) NULL,
Cname nvarchar (1024) NULL,
Visited_Num int NULL,
First_Visit_Time date NULL,
Visited_Num_15 int NULL,
Visited_Num_30 int NULL,
Url nvarchar (512) NULL,
Curl nvarchar (512) NULL,
CurlDate date NULL
);
truncate table ${targetTableName}
</update>
<insert id="insert" parameterType="com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase">
insert into dbo.ODS_HOUSINGCASELISTED_LJ_${yearMonth}_RAW
(
llid
, lcid
, Name
, Roomtype
, Area
, Towards
, Storey
, Lastdeal
, Condoelev
, Decoration
, Year
, Address
, Price
, Cname
, Visited_Num
, First_Visit_Time
, Visited_Num_15
, Visited_Num_30
, Url
, Curl
, CurlDate
) values
(
#{caseLianJiaId},
#{caseLianJiaCommunityId},
#{caseTitle},
#{caseApartmentLayout},
#{caseArea},
#{caseToward},
#{caseStorey},
#{caseLastDeal,jdbcType=DATE},
#{caseElevator},
#{caseDecoration},
#{caseYear},
#{caseAddress},
#{casePrice},
#{caseCommunityName},
#{caseVisitedNum},
#{caseFirstVisitTime,jdbcType=DATE},
#{caseVisitedNum15},
#{caseVisitedNum30},
#{caseUrl},
#{caseCommunityUrl},
#{caseGetDate,jdbcType=DATE}
)
</insert>
</mapper>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.basis.mapper.UVBasePriceMapper">
<!-- <resultMap id="resultMapping" type="com.ruoyi.project.data.basis.domain.UVBasePrice">-->
<!-- -->
<!-- </resultMap>-->
<select id="pageCount"
parameterType="com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel"
resultType="int">
select count(1) from dbo.TLK_基价信息
<where>
<if test="communityId != null">
ITEM_AIRAID=#{communityId}
</if>
<if test="valuePoint != null">
AND ITEM_VALUEPOINT=#{valuePoint}
</if>
<if test="communityType != null">
AND ITEM_PROJECTTYPE=#{communityType}
</if>
<if test="priceType != null">
AND ITEM_PRICETYPE=#{priceType}
</if>
</where>
</select>
<select id="pageList"
parameterType="com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel"
resultType="com.ruoyi.project.data.basis.domain.UVBasePrice">
<!-- <bind name="skip" value=" (pageIndex - 1) * pageSize "></bind>-->
SELECT ITEM_AIRAID as communityId
,ITEM_PROJECTTYPE as communityType
,ITEM_PRICETYPE as priceType
,ITEM_STANDARDPRICE as standardPrice
,ITEM_MAINAREAPRICE as mainAreaPrice
,ITEM_VALUEPOINT as valuePoint
,ITEM_PRICEEXPLAIN as comment
,ITEM_PRICECHG
FROM dbo.TLK_基价信息
<where>
<if test="communityId != null">
ITEM_AIRAID=#{communityId}
</if>
<if test="valuePoint != null">
AND ITEM_VALUEPOINT=#{valuePoint}
</if>
<if test="communityType != null">
AND ITEM_PROJECTTYPE=#{communityType}
</if>
<if test="priceType != null">
AND ITEM_PRICETYPE=#{priceType}
</if>
</where>
order by ITEM_VALUEPOINT desc,ITEM_AIRAID asc offset #{pageIndex} ROW FETCH NEXT #{pageSize} ROWS ONLY;
</select>
</mapper>

View File

@ -0,0 +1,89 @@
--
select t.*, left(addr_floornum,charindex('|', addr_floornum, 1)-1) as ,
substring(addr_floornum, charindex('|', addr_floornum, 1)+1, len(addr_floornum)-charindex('|', addr_floornum, 1)) as "所在层"
into #temp
from (
select a.*, dbo.remove_last_numbers(a.case_address) as addr_floornum
from dbo.original_residence_sale_closing_case_#yearMonth# a
) t;
update #temp set case_county_name=case_county_name+'区';
update #temp set case_county_name='浦东新区' where case_county_name='浦东区';
-- #result
select a.*, b.ID, b.ID,cast(left(case_signing_date,7) as varchar(16)) as
into #result
from #temp a
left join (
select row_number()over(partition by , order by newid()) sq, ID, ID, , from obpm_LianCheng_Data.dbo.AI单套地址20190508
) b
on a.case_county_name = b. and a. = b. and b.sq=1;
update b set b.clean_building_address=a.,
b.clean_current_floor=a.,
b.clean_building_id=a.ID,
b.clean_community_id=a.ID,
b.case_county_name=left(a.case_county_name, 2)
from #result a join dbo.original_residence_sale_closing_case_#yearMonth# b on a.id=b.id
insert into dbo.ODS_HOUSINGCASE_DEAL_#yearMonth#
(
case_id
, ProjectID
, BuildingID
, Area
, UpperFloorSum
, UpperFloorNum
, AreaCoff
, FloorCoff
, BuildingCoff
, PriceTotal
, PriceUnit
, PriceUnitAdj
, DateContract
)
select a.case_id
, a.clean_community_id
, a.clean_building_id
, a.case_area
, b.
, a.clean_current_floor
, d.CoefficientA * a.case_area + d.CoefficientB as AreaCoff
, 1 as FloorCoff
, e.Coefficient as BuildingCoff
, a.case_total_price
, a.case_total_price * 1.0 / a.case_area as PriceUnit
, a.case_total_price * 1.0 / a.case_area / isnull(d.CoefficientA * a.case_area + d.CoefficientB, 1)
/ isnull(e.Coefficient, 1) as PriceUnitAdj
, case_signing_date
from dbo.original_residence_sale_closing_case_#yearMonth# a
left join obpm_LianCheng_Data.dbo.AI楼栋数据_610 b
on a.clean_community_id = b.AI小区ID
and a.clean_building_id = b.AI楼栋ID
left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 c
on a.clean_community_id = c.ITEM_AIRAID and c.ITEM_PROJECTTYPE = '1'
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 f
on f.ITEM_DICVALUE = c.ITEM_PROPERTYLEVEL and f.ITEM_DICTYPE='物业档次'
left join
(
select ProjectLevel
, LowerKey
, UpperKey
, CoefficientA
, CoefficientB
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '面积修正(链家挂牌)'
and ProjectType = '公寓'
) d --
on f.ITEM_DICTEXT = d.ProjectLevel
and
(
a.case_area > d.LowerKey
and a.case_area <= d.UpperKey
)
left join obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF e
on a.clean_building_id = e.BuildingID
where a.case_area > 0 ;

View File

@ -0,0 +1,499 @@
update a
set a.uv_community_id=b.ITEM_ProjectID,
a.uv_building_id=b.ITEM_BuildingID,
a.area_coefficient= D.CoefficientA * A.case_area + D.CoefficientB,
a.toward_coefficient = e.Coefficient,
a.floor_coefficient= f.Coefficient,
a.decoration_coefficient=g.Coefficient,
a.year_coefficient=h.Coefficient,
a.building_coefficient=i.Coefficient,
a.adjust_unit_price = (A.clean_unit_price - isnull(G.Coefficient, 0)) * 1.0 /
isnull(D.CoefficientA * A.case_area + D.CoefficientB, 1) / isnull(E.Coefficient, 1) /
isnull(F.Coefficient, 1) / isnull(H.Coefficient, 1) / isnull(I.Coefficient, 1),
a.clean_project_level = C.PROJECTLEVEL,
a.uv_county=c.countyName,
a.uv_block=c.blockName,
a.uv_loop=c.loopName,
a.uv_community_name=c.ITEM_RANAME,
a.uv_community_address=c.ITEM_RAADRESS
from original_residence_sale_opening_case_#yearMonth# A
left join obpm_LianCheng_Data.dbo.TLK_链家小区 B
on A.case_lianjia_community_id = B.ITEM_ProjectID_LJ
left join
(
select X.ITEM_AIRAID
, y.ITEM_DICTEXT as PROJECTLEVEL
, y2.ITEM_DICTEXT as countyName
, y3.ITEM_DICTEXT as blockName
, y4.ITEM_DICTEXT as loopName
, x.ITEM_RANAME
, x.ITEM_RAADRESS
from obpm_LianCheng_Data.dbo.TLK_小区信息管理 x
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y
on x.ITEM_PROPERTYLEVEL = y.ITEM_DICVALUE
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y2 -- 区域
on x.ITEM_DISTRICT1 = y2.ITEM_DICVALUE
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y3 -- 板块
on x.ITEM_SECTOR121 = y3.ITEM_DICVALUE
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y4 -- 环线
on x.ITEM_CIRCLEPOSITION = y4.ITEM_DICVALUE
where X.ITEM_PROJECTTYPE = '1'
and y.ITEM_DICTYPE = '物业档次'
and y2.ITEM_DICTYPE = '区域'
and y3.ITEM_DICTYPE = '板块'
and y4.ITEM_DICTYPE = '环线'
) C
on B.ITEM_ProjectID = C.ITEM_AIRAID
left join
(
select ProjectLevel, LowerKey, UpperKey, Coefficient, CoefficientA, CoefficientB
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '面积修正(链家挂牌)'
and ProjectType = '公寓'
) D --
on C.PROJECTLEVEL = D.ProjectLevel
and
(
A.case_area > D.LowerKey
and A.case_area <= D.UpperKey
)
left join
(
select SingleKey, Coefficient
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '朝向(链家挂牌)'
and ProjectType = '公寓'
) E --
on A.clean_toward = E.SingleKey
left join
(
select SingleKey, Coefficient, Elevator, UpperKey, LowerKey
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '楼层(链家挂牌)'
and ProjectType = '公寓'
) F --
on isnull(A.clean_Elevator, 99) = isnull(F.Elevator, 99)
and A.clean_total_floor = F.UpperKey
and A.clean_current_floor_desc = F.LowerKey
left join
(
select SingleKey, Coefficient
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '室内装修(链家挂牌)'
and ProjectType = '公寓'
) G --
on A.clean_Decoration = G.SingleKey
left join
(
select SingleKey, Coefficient
from obpm_LianCheng_Data.dbo.DIM_PARAMETERS
where CoffType = '竣工日期'
and ProjectType = '公寓'
) H --
on A.clean_year = H.SingleKey
left join obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF I
on B.ITEM_BuildingID = I.BuildingID;
----#HousingCaseListAdj 插入挂牌清洗数据
------ 20200312BUG修复朝向处理规则优化
create table #HousingCaseListAdj
(
case_id varchar(32) not null
, HouseholdsID_LJ bigint
, ProjectID_LJ bigint
, Roomtype nvarchar(64)
, Area decimal(18, 2)
, Towards nvarchar(64)
, UpperFloorSum nvarchar(32)
, UpperFloorNum nvarchar(32)
, Elevator tinyint
, Decoration nvarchar(64)
, [Year] int
, PriceTotal decimal(18, 2)
, PriceUnit decimal(18, 2) not null
, Visited_Num int
, First_Visit_Time date
, Visited_Num_15 int
, Visited_Num_30 int
);
insert into #HousingCaseListAdj
(
case_id
, HouseholdsID_LJ
, ProjectID_LJ
, Roomtype
, Area
, Towards
, UpperFloorSum
, UpperFloorNum
, Elevator
, Decoration
, Year
, PriceTotal
, PriceUnit
)
select case_id
, case_lianjia_id
, case_lianjia_community_id
, case_apartment_layout
, case_area
, clean_toward
, clean_total_floor
, clean_current_floor_desc
, clean_elevator
, clean_decoration
, clean_year
, clean_total_price
, clean_unit_price
from original_residence_sale_opening_case_#yearMonth#;
----
create table #HousingCaseListSTD
(
case_id varchar(32) not null
, HouseholdsID_LJ bigint
, ProjectID_LJ bigint
, ProjectID bigint
, BuildingID bigint
, AreaCoff decimal(7, 4)
, TowardsCoff decimal(7, 4)
, FloorCoff decimal(7, 4)
, DecorationRng int
, YearCoff decimal(7, 4)
, BuildingCoff decimal(7, 4)
, PriceUnit decimal(18, 2) not null
, PriceUnitAdj decimal(18, 2) not null
);
insert into #HousingCaseListSTD
(
case_id
, HouseholdsID_LJ
, ProjectID_LJ
, ProjectID
, BuildingID
, AreaCoff
, TowardsCoff
, FloorCoff
, DecorationRng
, YearCoff
, BuildingCoff
, PriceUnit
, PriceUnitAdj
)
select case_id
, case_lianjia_id
, case_lianjia_community_id
, uv_community_id
, uv_building_id
, area_coefficient
, toward_coefficient
, floor_coefficient
, decoration_coefficient
, year_coefficient
, building_coefficient
, clean_unit_price
, adjust_unit_price
from dbo.original_residence_sale_opening_case_#yearMonth#;
--
--- 20200205BUG修复AdjustedValue、AdjustedPst 中当Status=1时值不为0的问题
select
a.case_id,
a.HouseholdsID_LJ,
case when b.Status is null then 3
when a.PriceTotal=b.PriceTotal then 1
else 2 end as Status,
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
when b.Status is null then 0
else a.PriceTotal-b.PriceTotal end AdjustedValue,
case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改
when b.Status is null then 0
else (a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotal end AdjustedPst,
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValue
when b.Status is null then 0
else b.AdjustedCumValue + a.PriceTotal-b.PriceTotal end AdjustedCumValue,
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPst
when b.Status is null then 0
else (b.AdjustedCumValue + a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotalIn end AdjustedCumPst,
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValueAbs
when b.Status is null then 0
else b.AdjustedCumValueAbs + abs(a.PriceTotal-b.PriceTotal) end AdjustedCumValueAbs,
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
when b.Status is null then 0
else (b.AdjustedCumValueAbs+ abs(a.PriceTotal-b.PriceTotal))*1.0/b.PriceTotalIn end AdjustedCumPstAbs,
case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs
when b.Status is null then 0
else b.AdjustedCumNum+1 end AdjustedCumNum,
case when b.Status is null then a.PriceTotal else b.PriceTotalIn end PriceTotalIn,
NULL as PriceTotalOut,
case when b.Status is null then getdate() else b.PriceDateIn end PriceDateIn,
cast(NULL as date) as PriceDateOut
into #HousingCaseListStatic
from #HousingCaseListAdj a
left join Ods_HousingCaseListed_LJ_#lastYearMonth# b
on a.HouseholdsID_LJ = b.HouseholdsID_LJ
--()
insert into dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth#
(
case_id
, HouseholdsID_LJ
, ProjectID_LJ
, ProjectID
, Roomtype
, Area
, Towards
, UpperFloorSum
, UpperFloorNum
, Elevator
, Decoration
, Year
, AreaCoff
, TowardsCoff
, FloorCoff
, DecorationRng
, YearCoff
, BuildingCoff
, PriceTotal
, PriceUnit
, PriceUnitAdj
, Visited_Num
, First_Visit_Time
, Visited_Num_15
, Visited_Num_30
, Status
, AdjustedValue
, AdjustedPst
, AdjustedCumValue
, AdjustedCumPst
, AdjustedCumValueAbs
, AdjustedCumPstAbs
, AdjustedCumNum
, PriceTotalIn
, PriceTotalOut
, PriceDateIn
, PriceDateOut
)
select a.case_id
, a.HouseholdsID_LJ
, a.ProjectID_LJ
, d.ProjectID
, a.Roomtype
, a.Area
, a.Towards
, a.UpperFloorSum
, a.UpperFloorNum
, a.Elevator
, a.Decoration
, a.[Year]
, b.AreaCoff
, b.TowardsCoff
, b.FloorCoff
, b.DecorationRng
, b.YearCoff
, b.BuildingCoff
, a.PriceTotal
, a.PriceUnit
, b.PriceUnitAdj
, a.Visited_Num
, a.First_Visit_Time
, a.Visited_Num_15
, a.Visited_Num_30
, c.Status
, c.AdjustedValue
, c.AdjustedPst
, c.AdjustedCumValue
, c.AdjustedCumPst
, c.AdjustedCumValueAbs
, c.AdjustedCumPstAbs
, c.AdjustedCumNum
, c.PriceTotalIn
, c.PriceTotalOut
, c.PriceDateIn
, c.PriceDateOut
from #HousingCaseListAdj a
left join #HousingCaseListSTD b
on a.HouseholdsID_LJ = b.HouseholdsID_LJ
left join #HousingCaseListStatic c
on a.HouseholdsID_LJ = c.HouseholdsID_LJ
left join DIM_PROJECTID_LJ2AI d
on a.ProjectID_LJ = d.ProjectID_LJ;
/*插入当月下架记录*/
-- #TmpRecordAdd然后插入到当月拍照表记为当月汇总表
insert into dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth#
(
case_id
, HouseholdsID_LJ
, ProjectID_LJ
, ProjectID
, Roomtype
, Area
, Towards
, UpperFloorSum
, UpperFloorNum
, Elevator
, Decoration
, Year
, AreaCoff
, TowardsCoff
, FloorCoff
, DecorationRng
, YearCoff
, BuildingCoff
, PriceTotal
, PriceUnit
, PriceUnitAdj
, Visited_Num
, First_Visit_Time
, Visited_Num_15
, Visited_Num_30
, Status
, AdjustedValue
, AdjustedPst
, AdjustedCumValue
, AdjustedCumPst
, AdjustedCumValueAbs
, AdjustedCumPstAbs
, AdjustedCumNum
, PriceTotalIn
, PriceTotalOut
, PriceDateIn
, PriceDateOut
)
select a.case_id
, a.HouseholdsID_LJ
, a.ProjectID_LJ
, a.ProjectID
, a.Roomtype
, a.Area
, a.Towards
, a.UpperFloorSum
, a.UpperFloorNum
, a.Elevator
, a.Decoration
, a.[Year]
, a.AreaCoff
, a.TowardsCoff
, a.FloorCoff
, a.DecorationRng
, a.YearCoff
, a.BuildingCoff
, a.PriceTotal
, a.PriceUnit
, a.PriceUnitAdj
, a.Visited_Num
, a.First_Visit_Time
, a.Visited_Num_15
, a.Visited_Num_30
, 4 as Status
, a.AdjustedValue
, a.AdjustedPst
, a.AdjustedCumValue
, a.AdjustedCumPst
, a.AdjustedCumValueAbs
, a.AdjustedCumPstAbs
, a.AdjustedCumNum
, a.PriceTotalIn
, a.PriceTotal as PriceTotalOut
, a.PriceDateIn
, getdate() as PriceDateOut
from ODS_HOUSINGCASELISTED_LJ_#lastYearMonth# a
left join ODS_HOUSINGCASELISTED_LJ_#yearMonth# b
on a.HouseholdsID_LJ = b.HouseholdsID_LJ
where b.HouseholdsID_LJ is null
and a.Status not in ( 4, 5 );
/*插入历史下架记录*/
insert into dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth#
(
case_id
, HouseholdsID_LJ
, ProjectID_LJ
, ProjectID
, Roomtype
, Area
, Towards
, UpperFloorSum
, UpperFloorNum
, Elevator
, Decoration
, Year
, AreaCoff
, TowardsCoff
, FloorCoff
, DecorationRng
, YearCoff
, BuildingCoff
, PriceTotal
, PriceUnit
, PriceUnitAdj
, Visited_Num
, First_Visit_Time
, Visited_Num_15
, Visited_Num_30
, Status
, AdjustedValue
, AdjustedPst
, AdjustedCumValue
, AdjustedCumPst
, AdjustedCumValueAbs
, AdjustedCumPstAbs
, AdjustedCumNum
, PriceTotalIn
, PriceTotalOut
, PriceDateIn
, PriceDateOut
)
select a.case_id
, a.HouseholdsID_LJ
, a.ProjectID_LJ
, a.ProjectID
, a.Roomtype
, a.Area
, a.Towards
, a.UpperFloorSum
, a.UpperFloorNum
, a.Elevator
, a.Decoration
, a.[Year]
, a.AreaCoff
, a.TowardsCoff
, a.FloorCoff
, a.DecorationRng
, a.YearCoff
, a.BuildingCoff
, a.PriceTotal
, a.PriceUnit
, a.PriceUnitAdj
, a.Visited_Num
, a.First_Visit_Time
, a.Visited_Num_15
, a.Visited_Num_30
, 5 as Status
, a.AdjustedValue
, a.AdjustedPst
, a.AdjustedCumValue
, a.AdjustedCumPst
, a.AdjustedCumValueAbs
, a.AdjustedCumPstAbs
, a.AdjustedCumNum
, a.PriceTotalIn
, a.PriceTotal as PriceTotalOut
, a.PriceDateIn
, a.PriceDateOut
from ODS_HOUSINGCASELISTED_LJ_#lastYearMonth# a
left join ODS_HOUSINGCASELISTED_LJ_#yearMonth# b
on a.HouseholdsID_LJ = b.HouseholdsID_LJ
where b.HouseholdsID_LJ is null
and a.Status in ( 4, 5 );
drop table #HousingCaseListAdj
drop table #HousingCaseListSTD
drop table #HousingCaseListStatic

View File

@ -37,4 +37,13 @@ public class MapperXmlGeneratorTests {
calendar.get(Calendar.MONTH)-1));
Assert.assertTrue(Objects.equals(lastYearMonth,202005));
}
@Test
public void testDemo(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
System.out.println(computeTableRoute);
}
}

View File

@ -0,0 +1,32 @@
package com.uvaluation.compute;
import com.ruoyi.RuoYiApplication;
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService;
import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService;
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.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RuoYiApplication.class)
public class ResidenceSaleBasePriceTests {
@Autowired
private IOriginalResidenceSaleOpeningCaseService originalResidenceOpeningCaseService;
@Autowired
private IOriginalResidenceSaleClosingCaseService originalResidenceClosingCaseService;
@Test
public void testClearOpeningCase() {
originalResidenceOpeningCaseService.pullData();
}
@Test
public void testClearClosingCase() {
originalResidenceClosingCaseService.pullData();
}
}