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

1. 成交案例下载和清洗
2. 挂牌案例下载、上传、清洗
3. 编写单元测试
4. 批量导入性能优化
This commit is contained in:
purple 2020-06-19 11:34:17 +08:00
parent 0d14af53ac
commit d7cd4e0b6d
35 changed files with 4378 additions and 820 deletions

View File

@ -0,0 +1,43 @@
import request from '@/utils/request'
// 查询住宅销售基价修正列表
export function list(query) {
return request({
url: '/data/price/residence/sale/artificial/list',
method: 'get',
params: query
})
}
// 查询住宅销售基价修正详细
export function get(id) {
return request({
url: '/data/price/residence/sale/artificial/' + id,
method: 'get'
})
}
// 修改住宅销售基价修正
export function update(data) {
return request({
url: '/data/price/residence/sale/artificial',
method: 'put',
data: data
})
}
// 导出住宅销售基价修正
export function export2File(query) {
return request({
url: '/data/price/residence/sale/artificial/export',
method: 'get',
params: query
})
}
export function getYearMonthList() {
return request({
url: '/data/price/residence/sale/artificial/yearmonth',
method: 'get'
})
}

View File

@ -0,0 +1,43 @@
import request from '@/utils/request'
// 查询住宅销售基价列表
export function list(query) {
return request({
url: '/data/price/residence/sale/compute/list',
method: 'get',
params: query
})
}
// 查询住宅销售基价详细
export function get(id) {
return request({
url: '/data/price/residence/sale/compute/' + id,
method: 'get'
})
}
// 修改住宅销售基价
export function update(data) {
return request({
url: '/data/price/residence/sale/compute',
method: 'put',
data: data
})
}
// 导出住宅销售基价
export function export2File(query) {
return request({
url: '/data/price/residence/sale/compute/export',
method: 'get',
params: query
})
}
export function getYearMonthList() {
return request({
url: '/data/price/residence/sale/compute/yearmonth',
method: 'get'
})
}

View File

@ -0,0 +1,479 @@
<template>
<div class="app-container">
<el-form :model="queryParams" :rules="rules" ref="queryForm" :inline="true" label-width="100px">
<el-form-item label="年月" prop="yearMonth">
<el-select v-model="queryParams.yearMonth" placeholder="请选择年月">
<el-option
v-for="item in yearMonthList"
:value="item.value"
:label="item.label"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<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="nameOrAddress" clearable>
<el-input
v-model="queryParams.nameOrAddress"
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-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="年月" align="center" prop="yearMonth" />
<el-table-column label="小区ID" align="center" prop="communityId" />
<el-table-column label="小区名称" align="center" prop="communityName" />
<el-table-column label="小区地址" align="center" prop="communityAddress" />
<el-table-column label="区域" align="center" prop="countyName" />
<el-table-column label="板块" align="center" prop="blockName" />
<el-table-column label="环线" align="center" prop="loopName" />
<el-table-column
label="是否生成索引"
align="center"
prop="hasIndex"
:formatter="yesOrNotFormatter"
/>
<el-table-column
label="参与涨幅计算"
align="center"
prop="isPstCalc"
:formatter="yesOrNotFormatter"
/>
<el-table-column label="运行状态" align="center" prop="status" />
<el-table-column label="特殊小区标签" align="center" prop="label" />
<el-table-column label="物业类型" align="center" prop="propertyType" />
<el-table-column label="小区类型" align="center" prop="projectType" />
<el-table-column label="小区类型细分" align="center" prop="projectTypeDtl" />
<el-table-column label="物业档次" align="center" prop="propertyLevel" />
<el-table-column label="建成年代" align="center" prop="year" />
<el-table-column label="主力面积" align="center" prop="area" />
<el-table-column label="房屋面积系数" align="center" prop="areaCoefficient" />
<el-table-column label="建成年代系数" align="center" prop="yearCoefficient" />
<el-table-column label="价格说明" align="center" prop="comment" />
<el-table-column label="AI基价(草稿)" align="center" prop="basePriceDraft" />
<el-table-column label="主力基价(草稿)" align="center" prop="mainPriceDraft" />
<el-table-column label="上月AI基价" align="center" prop="basePrice_1" />
<el-table-column label="价格涨跌幅类型-调整后" align="center" prop="voppat" />
<el-table-column label="价格涨跌幅-调整后" align="center" prop="voppa" />
<el-table-column label="案例均价" align="center" prop="priceUnitAdj" />
<el-table-column label="平均访客数量" align="center" prop="visitedNum" />
<el-table-column label="首次看房时间" align="center" prop="firstVisitTime" />
<el-table-column label="15天内平均访客数量" align="center" prop="visitedNum15" />
<el-table-column label="30天内平均访客数量" align="center" prop="visitedNum30" />
<el-table-column label="成交均价(上周期)" align="center" prop="priceDealMean_1" />
<el-table-column label="成交最大价(上周期)" align="center" prop="priceDealMax_1" />
<el-table-column label="成交数量(上周期)" align="center" prop="sumDeal_1" />
<el-table-column label="成交均价" align="center" prop="priceDealMean" />
<el-table-column label="成交最大价" align="center" prop="priceDealMax" />
<el-table-column label="成交数量" align="center" prop="sumDeal" />
<el-table-column label="挂牌最低价" align="center" prop="priceListedMin" />
<el-table-column label="与上月AI基价链家1案例价格价调整比例" align="center" prop="priceCase1_ToAI_Pst" />
<el-table-column label="与上月AI基价链家2案例价格价调整比例" align="center" prop="priceCase2_ToAI_Pst" />
<el-table-column label="当月比上月链1案例价调整比例" align="center" prop="priceCase1_ToLst_Pst" />
<el-table-column label="当月比上月链2案例价调整比例" align="center" prop="priceCase2_ToLst_Pst" />
<el-table-column label="链家1案例价" align="center" prop="priceCase1" />
<el-table-column label="链家1调价幅度" align="center" prop="priceCase1AdjPst" />
<el-table-column label="链家1案例总量" align="center" prop="sumCase1" />
<el-table-column label="链家2案例价" align="center" prop="priceCase2" />
<el-table-column label="链家2调价幅度" align="center" prop="priceCase2AdjPst" />
<el-table-column label="链家2案例总量" align="center" prop="sumCase2" />
<el-table-column label="价格涨跌幅类型-调整前" align="center" prop="voppbt" />
<el-table-column label="价格涨跌幅-调整前" align="center" prop="voppb" />
<el-table-column label="绑定小区编号" align="center" prop="bindCommunityId" />
<el-table-column label="绑定小区涨跌幅" align="center" prop="bindCommunityPst" />
<el-table-column label="绑定板块+聚类ID" align="center" prop="bindBlockClass" />
<el-table-column label="绑定板块+聚类ID的涨跌幅" align="center" prop="bindBlockClassPst" />
<el-table-column label="绑定板块+物业档次" align="center" prop="bindBlockPropertyLevel" />
<el-table-column label="绑定板块+物业档次的涨跌幅" align="center" prop="bindBlockPropertyLevelPst" />
<el-table-column label="绑定板块+小区类型" align="center" prop="bindBlockProjectType" />
<el-table-column label="绑定板块+小区类型的涨跌幅" align="center" prop="bindBlockProjectTypePst" />
<el-table-column label="绑定区县+小区类型" align="center" prop="bindCountyProjectType" />
<el-table-column label="绑定区县+小区类型的涨跌幅" align="center" prop="bindCountyProjectTypePst" />
<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.pageIndex"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<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 + '/' + queryParams.yearMonth"
: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>
<div class="el-upload__tip" slot="tip">
<el-alert :title="uploadTips" type="warning" effect="dark" :closable="false"></el-alert>
</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>
<!-- 添加或修改办公基价对话框 -->
<!-- <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>-->
</template>
<script>
import { getToken } from "@/utils/auth";
import {
list,
get,
update,
export2File,
getYearMonthList
} from "@/api/data/artificialResidenceSalePrice";
export default {
name: "artificialResidenceSalePrice",
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,
uploadTips: "",
//
queryParams: {
yearMonth: undefined,
communityId: undefined,
nameOrAddress: undefined,
pageIndex: 1,
pageSize: 10
},
yearMonthList: [],
statusOptions: [
{ value: 1, text: "正常" },
{ value: 1, text: "失效" }
],
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
headers: { Authorization: "Bearer " + getToken() },
//
url:
process.env.VUE_APP_BASE_API +
"/data/price/residence/sale/artificial/importData/"
},
//
form: {},
//
rules: {
yearMonth: [
{ validator: checkYearMonth, trigger: "blur" },
{ validator: checkYearMonth, trigger: "change" }
]
}
};
},
created() {
this.loading = false;
getYearMonthList().then(response => {
this.yearMonthList = response.data;
});
},
methods: {
// yearMonthChange: function(yearMonth) {
// this.upload.url += "/" + yearMonth;
// },
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.pageIndex = 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;
},
/** 修改按钮操作 */
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);
}
});
}
}
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$refs["queryForm"].validate(valid => {
if (valid) {
this.$confirm("是否确认导出住宅销售基价数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return export2File(queryParams);
})
.then(response => {
this.download(response.msg);
})
.catch(function() {});
}
});
},
handleImport() {
this.$refs["queryForm"].validate(valid => {
if (valid) {
this.upload.title = "住宅销售基价导入";
this.uploadTips = "当前选中的基价月份:" + this.queryParams.yearMonth;
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,380 @@
<template>
<div class="app-container">
<el-form :model="queryParams" :rules="rules" ref="queryForm" :inline="true" label-width="100px">
<el-form-item label="年月" prop="yearMonth">
<el-select v-model="queryParams.yearMonth" placeholder="请选择年月">
<el-option
v-for="item in yearMonthList"
:value="item.value"
:label="item.label"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<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="nameOrAddress" clearable>
<el-input
v-model="queryParams.nameOrAddress"
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-row :gutter="10" class="mb8">
<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-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="年月" align="center" prop="yearMonth" />
<el-table-column label="小区ID" align="center" prop="communityId" />
<el-table-column label="小区名称" align="center" prop="communityName" />
<el-table-column label="小区地址" align="center" prop="communityAddress" />
<el-table-column label="区域" align="center" prop="countyName" />
<el-table-column label="板块" align="center" prop="blockName" />
<el-table-column label="环线" align="center" prop="loopName" />
<el-table-column
label="是否生成索引"
align="center"
prop="hasIndex"
:formatter="yesOrNotFormatter"
/>
<el-table-column
label="参与涨幅计算"
align="center"
prop="isPstCalc"
:formatter="yesOrNotFormatter"
/>
<el-table-column label="运行状态" align="center" prop="status" />
<el-table-column label="特殊小区标签" align="center" prop="label" />
<el-table-column label="物业类型" align="center" prop="propertyType" />
<el-table-column label="小区类型" align="center" prop="projectType" />
<el-table-column label="小区类型细分" align="center" prop="projectTypeDtl" />
<el-table-column label="物业档次" align="center" prop="propertyLevel" />
<el-table-column label="建成年代" align="center" prop="year" />
<el-table-column label="主力面积" align="center" prop="area" />
<el-table-column label="房屋面积系数" align="center" prop="areaCoefficient" />
<el-table-column label="建成年代系数" align="center" prop="yearCoefficient" />
<el-table-column label="价格说明" align="center" prop="comment" />
<el-table-column label="AI基价(草稿)" align="center" prop="basePriceDraft" />
<el-table-column label="主力基价(草稿)" align="center" prop="mainPriceDraft" />
<el-table-column label="上月AI基价" align="center" prop="basePrice_1" />
<el-table-column label="价格涨跌幅类型-调整后" align="center" prop="voppat" />
<el-table-column label="价格涨跌幅-调整后" align="center" prop="voppa" />
<el-table-column label="案例均价" align="center" prop="priceUnitAdj" />
<el-table-column label="平均访客数量" align="center" prop="visitedNum" />
<el-table-column label="首次看房时间" align="center" prop="firstVisitTime" />
<el-table-column label="15天内平均访客数量" align="center" prop="visitedNum15" />
<el-table-column label="30天内平均访客数量" align="center" prop="visitedNum30" />
<el-table-column label="成交均价(上周期)" align="center" prop="priceDealMean_1" />
<el-table-column label="成交最大价(上周期)" align="center" prop="priceDealMax_1" />
<el-table-column label="成交数量(上周期)" align="center" prop="sumDeal_1" />
<el-table-column label="成交均价" align="center" prop="priceDealMean" />
<el-table-column label="成交最大价" align="center" prop="priceDealMax" />
<el-table-column label="成交数量" align="center" prop="sumDeal" />
<el-table-column label="挂牌最低价" align="center" prop="priceListedMin" />
<el-table-column label="与上月AI基价链家1案例价格价调整比例" align="center" prop="priceCase1_ToAI_Pst" />
<el-table-column label="与上月AI基价链家2案例价格价调整比例" align="center" prop="priceCase2_ToAI_Pst" />
<el-table-column label="当月比上月链1案例价调整比例" align="center" prop="priceCase1_ToLst_Pst" />
<el-table-column label="当月比上月链2案例价调整比例" align="center" prop="priceCase2_ToLst_Pst" />
<el-table-column label="链家1案例价" align="center" prop="priceCase1" />
<el-table-column label="链家1调价幅度" align="center" prop="priceCase1AdjPst" />
<el-table-column label="链家1案例总量" align="center" prop="sumCase1" />
<el-table-column label="链家2案例价" align="center" prop="priceCase2" />
<el-table-column label="链家2调价幅度" align="center" prop="priceCase2AdjPst" />
<el-table-column label="链家2案例总量" align="center" prop="sumCase2" />
<el-table-column label="价格涨跌幅类型-调整前" align="center" prop="voppbt" />
<el-table-column label="价格涨跌幅-调整前" align="center" prop="voppb" />
<el-table-column label="绑定小区编号" align="center" prop="bindCommunityId" />
<el-table-column label="绑定小区涨跌幅" align="center" prop="bindCommunityPst" />
<el-table-column label="绑定板块+聚类ID" align="center" prop="bindBlockClass" />
<el-table-column label="绑定板块+聚类ID的涨跌幅" align="center" prop="bindBlockClassPst" />
<el-table-column label="绑定板块+物业档次" align="center" prop="bindBlockPropertyLevel" />
<el-table-column label="绑定板块+物业档次的涨跌幅" align="center" prop="bindBlockPropertyLevelPst" />
<el-table-column label="绑定板块+小区类型" align="center" prop="bindBlockProjectType" />
<el-table-column label="绑定板块+小区类型的涨跌幅" align="center" prop="bindBlockProjectTypePst" />
<el-table-column label="绑定区县+小区类型" align="center" prop="bindCountyProjectType" />
<el-table-column label="绑定区县+小区类型的涨跌幅" align="center" prop="bindCountyProjectTypePst" />
<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.pageIndex"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import {
list,
get,
update,
export2File,
getYearMonthList
} from "@/api/data/computeResidenceSalePrice";
export default {
name: "computeResidenceSaleBasePrice",
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: {
yearMonth: undefined,
communityId: undefined,
nameOrAddress: undefined,
pageIndex: 1,
pageSize: 10
},
yearMonthList: [],
statusOptions: [
{ value: 1, text: "正常" },
{ value: 1, text: "失效" }
],
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: {
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.pageIndex = 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.$refs["queryForm"].validate(valid => {
if (valid) {
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

@ -98,7 +98,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope>
<!-- <scope>runtime</scope>-->
<version>7.4.0.jre8</version>
</dependency>

View File

@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
@ -53,11 +54,10 @@ import com.ruoyi.common.utils.reflect.ReflectUtils;
/**
* Excel相关处理
*
*
* @author ruoyi
*/
public class ExcelUtil<T>
{
public class ExcelUtil<T> {
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
/**
@ -105,15 +105,12 @@ public class ExcelUtil<T>
*/
public Class<T> clazz;
public ExcelUtil(Class<T> clazz)
{
public ExcelUtil(Class<T> clazz) {
this.clazz = clazz;
}
public void init(List<T> list, String sheetName, Type type)
{
if (list == null)
{
public void init(List<T> list, String sheetName, Type type) {
if (list == null) {
list = new ArrayList<T>();
}
this.list = list;
@ -125,62 +122,51 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @return 转换后集合
*/
public List<T> importExcel(InputStream is) throws Exception
{
public List<T> importExcel(InputStream is) throws Exception {
return importExcel(StringUtils.EMPTY, is);
}
/**
* 对excel表单指定表格索引名转换成list
*
*
* @param sheetName 表格索引名
* @param is 输入流
* @param is 输入流
* @return 转换后集合
*/
public List<T> importExcel(String sheetName, InputStream is) throws Exception
{
public List<T> importExcel(String sheetName, InputStream is) throws Exception {
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
List<T> list = new ArrayList<T>();
Sheet sheet = null;
if (StringUtils.isNotEmpty(sheetName))
{
if (StringUtils.isNotEmpty(sheetName)) {
// 如果指定sheet名,则取指定sheet中的内容.
sheet = wb.getSheet(sheetName);
}
else
{
} else {
// 如果传入的sheet名不存在则默认指向第1个sheet.
sheet = wb.getSheetAt(0);
}
if (sheet == null)
{
if (sheet == null) {
throw new IOException("文件sheet不存在");
}
int rows = sheet.getPhysicalNumberOfRows();
if (rows > 0)
{
if (rows > 0) {
// 定义一个map用于存放excel列的序号和field.
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(0);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
{
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) {
Cell cell = heard.getCell(i);
if (StringUtils.isNotNull(cell))
{
if (StringUtils.isNotNull(cell)) {
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
}
else
{
} else {
cellMap.put(null, i);
}
}
@ -188,25 +174,21 @@ public class ExcelUtil<T>
Field[] allFields = clazz.getDeclaredFields();
// 定义一个map用于存放列的序号和field.
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
for (int col = 0; col < allFields.length; col++)
{
for (int col = 0; col < allFields.length; col++) {
Field field = allFields[col];
Excel attr = field.getAnnotation(Excel.class);
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
{
if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) {
// 设置类的私有字段属性可访问.
field.setAccessible(true);
Integer column = cellMap.get(attr.name());
fieldsMap.put(column, field);
}
}
for (int i = 1; i < rows; i++)
{
for (int i = 1; i < rows; i++) {
// 从第2行开始取数据,默认第一行是表头.
Row row = sheet.getRow(i);
T entity = null;
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet())
{
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet()) {
Object val = this.getCellValue(row, entry.getKey());
// 如果不存在实例则新建.
@ -215,59 +197,36 @@ public class ExcelUtil<T>
Field field = fieldsMap.get(entry.getKey());
// 取得类型,并根据对象类型设置值.
Class<?> fieldType = field.getType();
if (String.class == fieldType)
{
if (String.class == fieldType) {
String s = Convert.toStr(val);
if (StringUtils.endsWith(s, ".0"))
{
if (StringUtils.endsWith(s, ".0")) {
val = StringUtils.substringBefore(s, ".0");
}
else
{
} else {
val = Convert.toStr(val);
}
}
else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType))
{
} else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType)) {
val = Convert.toInt(val);
}
else if ((Long.TYPE == fieldType) || (Long.class == fieldType))
{
} else if ((Long.TYPE == fieldType) || (Long.class == fieldType)) {
val = Convert.toLong(val);
}
else if ((Double.TYPE == fieldType) || (Double.class == fieldType))
{
} else if ((Double.TYPE == fieldType) || (Double.class == fieldType)) {
val = Convert.toDouble(val);
}
else if ((Float.TYPE == fieldType) || (Float.class == fieldType))
{
} else if ((Float.TYPE == fieldType) || (Float.class == fieldType)) {
val = Convert.toFloat(val);
}
else if (BigDecimal.class == fieldType)
{
} else if (BigDecimal.class == fieldType) {
val = Convert.toBigDecimal(val);
}
else if (Date.class == fieldType)
{
if (val instanceof String)
{
} else if (Date.class == fieldType) {
if (val instanceof String) {
val = DateUtils.parseDate(val);
}
else if (val instanceof Double)
{
} else if (val instanceof Double) {
val = DateUtil.getJavaDate((Double) val);
}
}
if (StringUtils.isNotNull(fieldType))
{
if (StringUtils.isNotNull(fieldType)) {
Excel attr = field.getAnnotation(Excel.class);
String propertyName = field.getName();
if (StringUtils.isNotEmpty(attr.targetAttr()))
{
if (StringUtils.isNotEmpty(attr.targetAttr())) {
propertyName = field.getName() + "." + attr.targetAttr();
}
else if (StringUtils.isNotEmpty(attr.readConverterExp()))
{
} else if (StringUtils.isNotEmpty(attr.readConverterExp())) {
val = reverseByExp(String.valueOf(val), attr.readConverterExp());
}
ReflectUtils.invokeSetter(entity, propertyName, val);
@ -281,56 +240,49 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param list 导出数据集合
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
*/
public AjaxResult exportExcel(List<T> list, String sheetName)
{
public AjaxResult exportExcel(List<T> list, String sheetName) {
this.init(list, sheetName, Type.EXPORT);
return exportExcel();
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
public AjaxResult importTemplateExcel(String sheetName)
{
public AjaxResult importTemplateExcel(String sheetName) {
this.init(null, sheetName, Type.IMPORT);
return exportExcel();
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public AjaxResult exportExcel()
{
public AjaxResult exportExcel() {
OutputStream out = null;
try
{
try {
// 取出一共有多少个sheet.
double sheetNo = Math.ceil(list.size() / sheetSize);
for (int index = 0; index <= sheetNo; index++)
{
for (int index = 0; index <= sheetNo; index++) {
createSheet(sheetNo, index);
// 产生一行
Row row = sheet.createRow(0);
int column = 0;
// 写入各个字段的列头名称
for (Object[] os : fields)
{
for (Object[] os : fields) {
Excel excel = (Excel) os[1];
this.createCell(excel, row, column++);
}
if (Type.EXPORT.equals(type))
{
if (Type.EXPORT.equals(type)) {
fillExcelData(index, row);
}
}
@ -338,33 +290,21 @@ public class ExcelUtil<T>
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
return AjaxResult.success(filename);
}
catch (Exception e)
{
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
throw new CustomException("导出Excel失败请联系网站管理员");
}
finally
{
if (wb != null)
{
try
{
} finally {
if (wb != null) {
try {
wb.close();
}
catch (IOException e1)
{
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (out != null)
{
try
{
if (out != null) {
try {
out.close();
}
catch (IOException e1)
{
} catch (IOException e1) {
e1.printStackTrace();
}
}
@ -373,22 +313,19 @@ public class ExcelUtil<T>
/**
* 填充excel数据
*
*
* @param index 序号
* @param row 单元格行
* @param row 单元格行
*/
public void fillExcelData(int index, Row row)
{
public void fillExcelData(int index, Row row) {
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, list.size());
for (int i = startNo; i < endNo; i++)
{
for (int i = startNo; i < endNo; i++) {
row = sheet.createRow(i + 1 - startNo);
// 得到导出对象.
T vo = (T) list.get(i);
int column = 0;
for (Object[] os : fields)
{
for (Object[] os : fields) {
Field field = (Field) os[0];
Excel excel = (Excel) os[1];
// 设置实体类私有属性可访问
@ -400,12 +337,11 @@ public class ExcelUtil<T>
/**
* 创建表格样式
*
*
* @param wb 工作薄对象
* @return 样式列表
*/
private Map<String, CellStyle> createStyles(Workbook wb)
{
private Map<String, CellStyle> createStyles(Workbook wb) {
// 写入各条记录,每条记录对应excel表中的一行
Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
CellStyle style = wb.createCellStyle();
@ -445,8 +381,7 @@ public class ExcelUtil<T>
/**
* 创建单元格
*/
public Cell createCell(Excel attr, Row row, int column)
{
public Cell createCell(Excel attr, Row row, int column) {
// 创建列
Cell cell = row.createCell(column);
// 写入列信息
@ -458,20 +393,16 @@ public class ExcelUtil<T>
/**
* 设置单元格信息
*
*
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
* @param attr 注解相关
* @param cell 单元格信息
*/
public void setCellVo(Object value, Excel attr, Cell cell)
{
if (ColumnType.STRING == attr.cellType())
{
public void setCellVo(Object value, Excel attr, Cell cell) {
if (ColumnType.STRING == attr.cellType()) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
}
else if (ColumnType.NUMERIC == attr.cellType())
{
} else if (ColumnType.NUMERIC == attr.cellType()) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(Integer.parseInt(value + ""));
}
@ -480,27 +411,21 @@ public class ExcelUtil<T>
/**
* 创建表格样式
*/
public void setDataValidation(Excel attr, Row row, int column)
{
if (attr.name().indexOf("注:") >= 0)
{
public void setDataValidation(Excel attr, Row row, int column) {
if (attr.name().indexOf("注:") >= 0) {
sheet.setColumnWidth(column, 6000);
}
else
{
} else {
// 设置列宽
sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
row.setHeight((short) (attr.height() * 20));
}
// 如果设置了提示信息则鼠标放上去提示.
if (StringUtils.isNotEmpty(attr.prompt()))
{
if (StringUtils.isNotEmpty(attr.prompt())) {
// 这里默认设了2-101列提示.
setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
}
// 如果设置了combo属性则本列只能选择不能输入
if (attr.combo().length > 0)
{
if (attr.combo().length > 0) {
// 这里默认设了2-101列只能选择不能输入.
setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
}
@ -509,16 +434,13 @@ public class ExcelUtil<T>
/**
* 添加单元格
*/
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
{
public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
Cell cell = null;
try
{
try {
// 设置行高
row.setHeight((short) (attr.height() * 20));
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
if (attr.isExport())
{
if (attr.isExport()) {
// 创建cell
cell = row.createCell(column);
cell.setCellStyle(styles.get("data"));
@ -527,23 +449,16 @@ public class ExcelUtil<T>
Object value = getTargetValue(vo, field, attr);
String dateFormat = attr.dateFormat();
String readConverterExp = attr.readConverterExp();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
{
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) {
cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value));
}
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
{
} else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) {
cell.setCellValue(convertByExp(String.valueOf(value), readConverterExp));
}
else
{
} else {
// 设置列类型
setCellVo(value, attr, cell);
}
}
}
catch (Exception e)
{
} catch (Exception e) {
log.error("导出Excel失败{}", e);
}
return cell;
@ -551,18 +466,17 @@ public class ExcelUtil<T>
/**
* 设置 POI XSSFSheet 单元格提示
*
* @param sheet 表单
* @param promptTitle 提示标题
*
* @param sheet 表单
* @param promptTitle 提示标题
* @param promptContent 提示内容
* @param firstRow 开始行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
* @param firstRow 开始行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
*/
public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
int firstCol, int endCol)
{
int firstCol, int endCol) {
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
@ -574,17 +488,16 @@ public class ExcelUtil<T>
/**
* 设置某些列的值只能输入预制的数据,显示下拉框.
*
* @param sheet 要设置的sheet.
*
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param firstRow 开始行
* @param endRow 结束行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
* @param endCol 结束列
* @return 设置好的sheet.
*/
public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol)
{
public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
DataValidationHelper helper = sheet.getDataValidationHelper();
// 加载下拉列表内容
DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
@ -593,13 +506,10 @@ public class ExcelUtil<T>
// 数据有效性对象
DataValidation dataValidation = helper.createValidation(constraint, regions);
// 处理Excel兼容性问题
if (dataValidation instanceof XSSFDataValidation)
{
if (dataValidation instanceof XSSFDataValidation) {
dataValidation.setSuppressDropDownArrow(true);
dataValidation.setShowErrorBox(true);
}
else
{
} else {
dataValidation.setSuppressDropDownArrow(false);
}
@ -608,28 +518,22 @@ public class ExcelUtil<T>
/**
* 解析导出值 0=,1=,2=未知
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param converterExp 翻译注解
* @return 解析后值
* @throws Exception
*/
public static String convertByExp(String propertyValue, String converterExp) throws Exception
{
try
{
public static String convertByExp(String propertyValue, String converterExp) throws Exception {
try {
String[] convertSource = converterExp.split(",");
for (String item : convertSource)
{
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (itemArray[0].equals(propertyValue))
{
if (itemArray[0].equals(propertyValue)) {
return itemArray[1];
}
}
}
catch (Exception e)
{
} catch (Exception e) {
throw e;
}
return propertyValue;
@ -637,28 +541,22 @@ public class ExcelUtil<T>
/**
* 反向解析值 =0,=1,未知=2
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param converterExp 翻译注解
* @return 解析后值
* @throws Exception
*/
public static String reverseByExp(String propertyValue, String converterExp) throws Exception
{
try
{
public static String reverseByExp(String propertyValue, String converterExp) throws Exception {
try {
String[] convertSource = converterExp.split(",");
for (String item : convertSource)
{
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (itemArray[1].equals(propertyValue))
{
if (itemArray[1].equals(propertyValue)) {
return itemArray[0];
}
}
}
catch (Exception e)
{
} catch (Exception e) {
throw e;
}
return propertyValue;
@ -667,23 +565,20 @@ public class ExcelUtil<T>
/**
* 编码文件名
*/
public String encodingFilename(String filename)
{
filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
public String encodingFilename(String filename) {
filename = filename + "_" + UUID.randomUUID().toString() + ".xlsx";
return filename;
}
/**
* 获取下载路径
*
*
* @param filename 文件名称
*/
public String getAbsoluteFile(String filename)
{
public String getAbsoluteFile(String filename) {
String downloadPath = RuoYiConfig.getDownloadPath() + filename;
File desc = new File(downloadPath);
if (!desc.getParentFile().exists())
{
if (!desc.getParentFile().exists()) {
desc.getParentFile().mkdirs();
}
return downloadPath;
@ -691,29 +586,23 @@ public class ExcelUtil<T>
/**
* 获取bean中的属性值
*
* @param vo 实体对象
*
* @param vo 实体对象
* @param field 字段
* @param excel 注解
* @return 最终的属性值
* @throws Exception
*/
private Object getTargetValue(T vo, Field field, Excel excel) throws Exception
{
private Object getTargetValue(T vo, Field field, Excel excel) throws Exception {
Object o = field.get(vo);
if (StringUtils.isNotEmpty(excel.targetAttr()))
{
if (StringUtils.isNotEmpty(excel.targetAttr())) {
String target = excel.targetAttr();
if (target.indexOf(".") > -1)
{
if (target.indexOf(".") > -1) {
String[] targets = target.split("[.]");
for (String name : targets)
{
for (String name : targets) {
o = getValue(o, name);
}
}
else
{
} else {
o = getValue(o, target);
}
}
@ -722,16 +611,14 @@ public class ExcelUtil<T>
/**
* 以类的属性的get方法方法形式获取值
*
*
* @param o
* @param name
* @return value
* @throws Exception
*/
private Object getValue(Object o, String name) throws Exception
{
if (StringUtils.isNotEmpty(name))
{
private Object getValue(Object o, String name) throws Exception {
if (StringUtils.isNotEmpty(name)) {
Class<?> clazz = o.getClass();
String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method method = clazz.getMethod(methodName);
@ -743,27 +630,22 @@ public class ExcelUtil<T>
/**
* 得到所有定义字段
*/
private void createExcelField()
{
private void createExcelField() {
this.fields = new ArrayList<Object[]>();
List<Field> tempFields = new ArrayList<>();
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
for (Field field : tempFields)
{
for (Field field : tempFields) {
// 单注解
if (field.isAnnotationPresent(Excel.class))
{
if (field.isAnnotationPresent(Excel.class)) {
putToField(field, field.getAnnotation(Excel.class));
}
// 多注解
if (field.isAnnotationPresent(Excels.class))
{
if (field.isAnnotationPresent(Excels.class)) {
Excels attrs = field.getAnnotation(Excels.class);
Excel[] excels = attrs.value();
for (Excel excel : excels)
{
for (Excel excel : excels) {
putToField(field, excel);
}
}
@ -773,98 +655,72 @@ public class ExcelUtil<T>
/**
* 放到字段集合中
*/
private void putToField(Field field, Excel attr)
{
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
{
this.fields.add(new Object[] { field, attr });
private void putToField(Field field, Excel attr) {
if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) {
this.fields.add(new Object[]{field, attr});
}
}
/**
* 创建一个工作簿
*/
public void createWorkbook()
{
public void createWorkbook() {
this.wb = new SXSSFWorkbook(500);
}
/**
* 创建工作表
*
*
* @param sheetNo sheet数量
* @param index 序号
* @param index 序号
*/
public void createSheet(double sheetNo, int index)
{
public void createSheet(double sheetNo, int index) {
this.sheet = wb.createSheet();
this.styles = createStyles(wb);
// 设置工作表的名称.
if (sheetNo == 0)
{
if (sheetNo == 0) {
wb.setSheetName(index, sheetName);
}
else
{
} else {
wb.setSheetName(index, sheetName + index);
}
}
/**
* 获取单元格值
*
* @param row 获取的行
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
*/
public Object getCellValue(Row row, int column)
{
if (row == null)
{
public Object getCellValue(Row row, int column) {
if (row == null) {
return row;
}
Object val = "";
try
{
try {
Cell cell = row.getCell(column);
if (StringUtils.isNotNull(cell))
{
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
{
if (StringUtils.isNotNull(cell)) {
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) {
val = cell.getNumericCellValue();
if (HSSFDateUtil.isCellDateFormatted(cell))
{
if (HSSFDateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
}
else
{
if ((Double) val % 1 > 0)
{
} else {
if ((Double) val % 1 > 0) {
val = new DecimalFormat("0.00").format(val);
}
else
{
} else {
val = new DecimalFormat("0").format(val);
}
}
}
else if (cell.getCellTypeEnum() == CellType.STRING)
{
} else if (cell.getCellTypeEnum() == CellType.STRING) {
val = cell.getStringCellValue();
}
else if (cell.getCellTypeEnum() == CellType.BOOLEAN)
{
} else if (cell.getCellTypeEnum() == CellType.BOOLEAN) {
val = cell.getBooleanCellValue();
}
else if (cell.getCellTypeEnum() == CellType.ERROR)
{
} else if (cell.getCellTypeEnum() == CellType.ERROR) {
val = cell.getErrorCellValue();
}
}
}
catch (Exception e)
{
} catch (Exception e) {
return val;
}
return val;

View File

@ -1,109 +1,109 @@
package com.ruoyi.project.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.framework.web.domain.AjaxResult;
/**
* 通用请求处理
*
* @author ruoyi
*/
@RestController
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.isValidFilename(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
{
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
}
package com.ruoyi.project.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.framework.web.domain.AjaxResult;
/**
* 通用请求处理
*
* @author ruoyi
*/
@RestController
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.isValidFilename(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, fileName));
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
{
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
}

View File

@ -33,6 +33,19 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
* @return
*/
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
/**
* 作价表
* @param yearMonth
* @return
*/
int createComputePriceTable(@Param("yearMonth") Integer yearMonth);
/**
* 人工修正价格表
* @param yearMonth
* @return
*/
int createArtificialPriceTable(@Param("yearMonth") Integer yearMonth);
/**
* 分页总数

View File

@ -102,7 +102,7 @@ public class OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalRes
*/
public void after(Integer yearMonth) {
// 清洗挂牌案例
String rawSql = LoadUtil.loadContent("sql-template/clear_closing_case.sql");
String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_closing_case.sql");
String sql = rawSql.replace("#yearMonth#", yearMonth.toString());
jdbcTemplate.update(sql);
}

View File

@ -17,6 +17,7 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -50,6 +51,8 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
calendar.get(Calendar.MONTH)));
Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
Date valuePoint = calendar.getTime();
calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
@ -59,11 +62,10 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
list.parallelStream().forEach(originalResidenceOpeningCase -> {
originalResidenceOpeningCase.clear();
originalResidenceOpeningCase.setYearMonth(syncTableRoute);
// logger.debug(originalResidenceOpeningCase.toString());
syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase);
});
running(computeTableRoute, syncTableRoute, list);
after(computeTableRoute, lastYearMonth);
running(computeTableRoute, list);
after(computeTableRoute, lastYearMonth, valuePoint);
}
/**
@ -75,6 +77,10 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
originalResidenceSaleOpeningCaseMapper.createTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
}
@ -84,7 +90,7 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
* @param computeTableRoute
* @param list
*/
public void running(Integer computeTableRoute, Integer syncTableRoute, List<OriginalResidenceSaleOpeningCase> list) {
public void running(Integer computeTableRoute, 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, " +
@ -108,15 +114,27 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
/**
* 匹配数据
* 计算基价
*
* @param yearMonth
* @param lastYearMonth
* @param valuePoint
*/
public void after(Integer yearMonth, Integer lastYearMonth) {
public void after(Integer yearMonth, Integer lastYearMonth, Date valuePoint) {
// 清洗挂牌案例
String rawSql = LoadUtil.loadContent("sql-template/clear_opening_case.sql");
String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_opening_case.sql");
String sql = rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString());
jdbcTemplate.update(sql);
// 作价
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
rawSql = LoadUtil.loadContent("sql-template/compute_residence_sale_base_price.sql");
sql = rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString())
.replace("#valuePoint#", simpleDateFormat.format(valuePoint));
jdbcTemplate.update(sql);
logger.debug("#作价完成#");
}
}

View File

@ -1,107 +0,0 @@
//package com.ruoyi.project.data.price.controller;
//
//import com.ruoyi.common.utils.ServletUtils;
//import com.ruoyi.common.utils.poi.ExcelUtil;
//import com.ruoyi.framework.aspectj.lang.annotation.Log;
//import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
//import com.ruoyi.framework.security.LoginUser;
//import com.ruoyi.framework.security.service.TokenService;
//import com.ruoyi.framework.web.controller.BaseController;
//import com.ruoyi.framework.web.domain.AjaxResult;
//import com.ruoyi.framework.web.page.TableDataInfo;
//import com.ruoyi.framework.web.page.TableSupport;
//import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
//import com.ruoyi.project.data.price.service.IOfficeBasePriceUltimateService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.util.List;
//
///**
// * 请填写功能名称Controller
// *
// * @author ruoyi
// * @date 2020-05-20
// */
//@RestController
//@RequestMapping("/data/compute/price/office")
//public class ArtificialOfficeBasePriceController extends BaseController {
// @Autowired
// private IOfficeBasePriceUltimateService officeBasePriceUltimateService;
// @Autowired
// private TokenService tokenService;
//
// /**
// * 查询请填写功能名称列表
// */
// @PreAuthorize("@ss.hasPermi('system:user:list')")
// @GetMapping("/list")
// public TableDataInfo list(OfficeBasePriceUltimate officeBasePriceUltimate) {
// int pageIndex = ServletUtils.getParameterToInt(TableSupport.PAGE_NUM);
// int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
// officeBasePriceUltimate.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
// officeBasePriceUltimate.setPageSize(pageSize);
// List<OfficeBasePriceUltimate> list =
// officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
// int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
// return getDataTable(list, total);
// }
//
//
// /**
// * 获取请填写功能名称详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:user:query')")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") String id) {
// return AjaxResult.success(officeBasePriceUltimateService.selectOfficeBasePriceUltimateById(id));
// }
//
// /**
// * 修改请填写功能名称
// */
// @PreAuthorize("@ss.hasPermi('system:user:edit')")
// @Log(title = "办公基价", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody OfficeBasePriceUltimate officeBasePriceUltimate) {
// return toAjax(officeBasePriceUltimateService.updateOfficeBasePriceUltimate(officeBasePriceUltimate));
// }
//
// /**
// * 导出请填写功能名称列表
// */
// @PreAuthorize("@ss.hasPermi('system:user:export')")
// @Log(title = "办公基价", businessType = BusinessType.EXPORT)
// @GetMapping("/export")
// public AjaxResult export(OfficeBasePriceUltimate officeBasePriceUltimate) {
// int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
// officeBasePriceUltimate.setPageIndex(0);
// officeBasePriceUltimate.setPageSize(total);
// List<OfficeBasePriceUltimate> list =
// officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
// ExcelUtil<OfficeBasePriceUltimate> util = new ExcelUtil<OfficeBasePriceUltimate>(OfficeBasePriceUltimate.class);
// return util.exportExcel(list, "办公基价");
// }
//
// /**
// * 办公基价导入
// * @param file
// * @return
// * @throws Exception
// */
// @Log(title = "办公基价", businessType = BusinessType.IMPORT)
// @PreAuthorize("@ss.hasPermi('system:user:import')")
// @PostMapping("/importData")
// public AjaxResult importData(MultipartFile file) throws Exception {
// ExcelUtil<OfficeBasePriceUltimate> util = new ExcelUtil<>(OfficeBasePriceUltimate.class);
// List<OfficeBasePriceUltimate> officeBasePriceUltimates = util.importExcel(file.getInputStream());
// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
// String operName = loginUser.getUsername();
// String message = officeBasePriceUltimateService.batchImport(officeBasePriceUltimates, operName);
// return AjaxResult.success(message);
// }
//
//}
//

View File

@ -1,4 +0,0 @@
package com.ruoyi.project.data.price.controller;
public class ArtificialResidenceSaleBasePriceController {
}

View File

@ -0,0 +1,267 @@
package com.ruoyi.project.data.price.controller;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import com.ruoyi.project.data.price.service.IArtificialResidenceRentPriceService;
import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IUltimateResidenceRentBasePriceService;
import com.ruoyi.project.system.domain.UploadFile;
import com.ruoyi.project.system.service.IUploadFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@RestController
@RequestMapping("/data/price/residence/sale")
public class ResidenceSaleBasePriceController extends BaseController {
@Autowired
private IOriginalResidenceSalePriceService computeResidenceSalePriceService;
@Autowired
private IArtificialResidenceSalePriceService artificialResidenceSalePriceService;
@Autowired
private IUltimateResidenceRentBasePriceService ultimateResidenceRentBasePriceService;
@Autowired
private IUploadFileService fileService;
@Autowired
private TokenService tokenService;
/**
* 查询 住宅租赁基价列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/compute/list")
public TableDataInfo computeList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice) {
int pageIndex = ServletUtils.getParameterToInt("pageIndex");
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
computeResidenceSaleBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
computeResidenceSaleBasePrice.setPageSize(pageSize);
int total = computeResidenceSalePriceService.selectCount(computeResidenceSaleBasePrice);
List<ComputeResidenceSaleBasePrice> list =
computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice);
list.forEach(x -> x.setYearMonth(computeResidenceSaleBasePrice.getYearMonth()));
return getDataTable(list, total);
}
/**
* 查询 年月
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/compute/yearmonth")
public AjaxResult computeYearMonthList() {
List<VueSelectModel> list = computeResidenceSalePriceService.getYearMonth();
return AjaxResult.success(list);
}
/**
* 导出 住宅销售基价列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "住宅销售基价", businessType = BusinessType.EXPORT)
@GetMapping("/compute/export")
public AjaxResult computeExport(ComputeResidenceSaleBasePrice
computeResidenceSaleBasePrice) {
int total = computeResidenceSalePriceService.selectCount(computeResidenceSaleBasePrice);
computeResidenceSaleBasePrice.setPageIndex(0);
computeResidenceSaleBasePrice.setPageSize(total);
List<ComputeResidenceSaleBasePrice> list =
computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice);
ExcelUtil<ComputeResidenceSaleBasePrice> util = new ExcelUtil<>(ComputeResidenceSaleBasePrice.class);
return util.exportExcel(list, "住宅销售基价" + computeResidenceSaleBasePrice.getYearMonth());
}
/**
* 查询 住宅租赁基价列表
*/
@PreAuthorize("@ss.hasPermi('system:artificial:list')")
@GetMapping("/artificial/list")
public TableDataInfo artificialList(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice) {
int pageIndex = ServletUtils.getParameterToInt("pageIndex");
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
artificialResidenceSaleBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
artificialResidenceSaleBasePrice.setPageSize(pageSize);
int total = artificialResidenceSalePriceService.selectCount(artificialResidenceSaleBasePrice);
List<ArtificialResidenceSaleBasePrice> list =
artificialResidenceSalePriceService.selectList(artificialResidenceSaleBasePrice);
list.forEach(x -> x.setYearMonth(artificialResidenceSaleBasePrice.getYearMonth()));
return getDataTable(list, total);
}
/**
* 查询 年月
*/
@PreAuthorize("@ss.hasPermi('system:artificial:list')")
@GetMapping("/artificial/yearmonth")
public AjaxResult artificialYearMonthList() {
List<VueSelectModel> list = artificialResidenceSalePriceService.getYearMonth();
return AjaxResult.success(list);
}
/**
* 导出 住宅销售基价列表
*/
@PreAuthorize("@ss.hasPermi('system:artificial:export')")
@Log(title = "住宅销售基价", businessType = BusinessType.EXPORT)
@GetMapping("/artificial/export")
public AjaxResult artificialExport(ArtificialResidenceSaleBasePrice
artificialResidenceSaleBasePrice) {
int total = artificialResidenceSalePriceService.selectCount(artificialResidenceSaleBasePrice);
artificialResidenceSaleBasePrice.setPageIndex(0);
artificialResidenceSaleBasePrice.setPageSize(total);
List<ArtificialResidenceSaleBasePrice> list =
artificialResidenceSalePriceService.selectList(artificialResidenceSaleBasePrice);
ExcelUtil<ArtificialResidenceSaleBasePrice> util = new ExcelUtil<>(ArtificialResidenceSaleBasePrice.class);
return util.exportExcel(list, "人工修正住宅销售基价" + artificialResidenceSaleBasePrice.getYearMonth());
}
/**
* 获取 人工修正基价详细信息
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = "/artificial/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(artificialResidenceSalePriceService.selectById(id));
}
/**
* 修改 住宅租赁基价
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "住宅售价基价", businessType = BusinessType.UPDATE)
@PutMapping(value = "/artificial")
public AjaxResult edit(@RequestBody ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice) {
return toAjax(artificialResidenceSalePriceService.updateEntity(artificialResidenceSaleBasePrice));
}
/**
* 办公基价导入
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "办公基价", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/artificial/importData/{yearMonth}")
public AjaxResult importData(@PathVariable("yearMonth") Integer yearMonth,
MultipartFile file) throws Exception {
ExcelUtil<ComputeResidenceSaleBasePrice> util = new ExcelUtil<>(ComputeResidenceSaleBasePrice.class);
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername();
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
UploadFile uploadFile = new UploadFile();
uploadFile.setFk(yearMonth.toString());
uploadFile.setSaveFileName(fileName);
uploadFile.setFileName(file.getOriginalFilename());
uploadFile.setModuleName("人工修正住宅销售基价");
uploadFile.setCreateBy(operName);
fileService.insert(uploadFile);
List<ComputeResidenceSaleBasePrice> artificialResidenceSaleBasePrices = util.importExcel(file.getInputStream
());
if (StringUtils.isNull(artificialResidenceSaleBasePrices) || artificialResidenceSaleBasePrices.size() == 0) {
throw new CustomException("人工修正住宅销售基价不能为空!");
}
String message = artificialResidenceSalePriceService.batchImport(yearMonth, artificialResidenceSaleBasePrices);
return AjaxResult.success(message);
}
//
// /**
// * 人工修正住宅租赁
// *
// * @param artificialResidenceRentBasePrice
// * @return
// */
// @PreAuthorize("@ss.hasPermi('system:user:list')")
// @GetMapping("/artificial/list")
// public TableDataInfo artificialByList(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice) {
// int pageIndex = ServletUtils.getParameterToInt("pageIndex");
// int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
// artificialResidenceRentBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
// artificialResidenceRentBasePrice.setPageSize(pageSize);
//
// int total = artificialResidenceRentPriceService.selectCount(artificialResidenceRentBasePrice);
// List<ArtificialResidenceRentBasePrice> list =
// artificialResidenceRentPriceService.selectList(artificialResidenceRentBasePrice);
// list.forEach(x -> x.setYearMonth(artificialResidenceRentBasePrice.getYearMonth()));
// return getDataTable(list, total);
// }
//
//
// // 文件保存
//
//
// /**
// * 查询 住宅租赁基价列表
// */
// @PreAuthorize("@ss.hasPermi('system:user:list')")
// @GetMapping("/ultimate/list")
// public TableDataInfo ultimateResidenceRentBasePriceList(UltimateResidenceRentBasePrice
// ultimateResidenceRentBasePrice) {
// int pageIndex = ServletUtils.getParameterToInt("pageIndex");
// int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
// ultimateResidenceRentBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
// ultimateResidenceRentBasePrice.setPageSize(pageSize);
//
// int total = ultimateResidenceRentBasePriceService.selectCount(ultimateResidenceRentBasePrice);
// List<UltimateResidenceRentBasePrice> list =
// ultimateResidenceRentBasePriceService.selectList(ultimateResidenceRentBasePrice);
// list.forEach(x -> x.setYearMonth(ultimateResidenceRentBasePrice.getYearMonth()));
// return getDataTable(list, total);
// }
//
// /**
// * 人工审核住宅租赁基价导入模板
// * 记录变化的值和变化次数
// */
//
// /**
// * 获取 住宅租赁基价详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:user:query')")
// @GetMapping(value = "/ultimate/{id}")
// public AjaxResult ultimateResidenceRentBasePriceGet(@PathVariable("id") Integer id) {
// return AjaxResult.success(ultimateResidenceRentBasePriceService.selectById(id));
// }
//
// /**
// * 修改 住宅租赁基价
// */
// @PreAuthorize("@ss.hasPermi('system:user:edit')")
// @Log(title = "住宅租赁基价", businessType = BusinessType.UPDATE)
// @PutMapping(value = "/ultimate")
// public AjaxResult ultimateResidenceRentBasePriceEdit(@RequestBody UltimateResidenceRentBasePrice
// ultimateResidenceRentBasePrice) {
// return toAjax(ultimateResidenceRentBasePriceService.update(ultimateResidenceRentBasePrice));
// }
//
}

View File

@ -4,173 +4,48 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 请填写功能名称对象 office_base_price_ultimate
*
* @author ruoyi
* @date 2020-05-20
* 人工修正住宅基价
*/
public class ArtificialResidenceSaleBasePrice extends BaseEntity {
public class ArtificialResidenceSaleBasePrice extends ComputeResidenceSaleBasePrice {
private Integer pageIndex;
private Integer pageSize;
/**
* 价值时点
*/
private Date valuePoint;
/**
* 上期价值时点
*/
private Date lastValuePoint;
/**
* 价格id随机生成
*/
private String priceId;
@Excel(name = "ID")
private String id;
@JSONField(serialize = false)
private Integer yearMonth;
@Excel(name = "楼栋ID")
private String buildingId;
@Excel(name = "小区ID")
private String communityId;
@Excel(name = "主力基价")
private String mainPrice;
@Excel(name = "主力租金")
private String mainPriceRent;
@Excel(name = "主力基价涨跌幅")
private String mainPricePst;
@Excel(name = "主力租金涨跌幅")
private String mainPriceRentPst;
@Excel(name = "主力基价类型")
private String mainPriceType;
@Excel(name = "主力租金类型")
private String mainPriceRentType;
@Excel(name = "更新日期")
private Date updateDate;
@Excel(name = "状态")
private Boolean status;
@Excel(name = "是否标准楼栋")
private Boolean isStandardBuilding;
@Excel(name = "更改价格说明")
private String adjustPriceComment;
public String getId() {
return id;
public Date getValuePoint() {
return valuePoint;
}
public void setId(String id) {
this.id = id;
public void setValuePoint(Date valuePoint) {
this.valuePoint = valuePoint;
}
public Integer getYearMonth() {
return yearMonth;
public String getPriceId() {
return priceId;
}
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
public void setPriceId(String priceId) {
this.priceId = priceId;
}
public String getBuildingId() {
return buildingId;
public Date getLastValuePoint() {
return lastValuePoint;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getMainPrice() {
return mainPrice;
}
public void setMainPrice(String mainPrice) {
this.mainPrice = mainPrice;
}
public String getMainPriceRent() {
return mainPriceRent;
}
public void setMainPriceRent(String mainPriceRent) {
this.mainPriceRent = mainPriceRent;
}
public String getMainPricePst() {
return mainPricePst;
}
public void setMainPricePst(String mainPricePst) {
this.mainPricePst = mainPricePst;
}
public String getMainPriceRentPst() {
return mainPriceRentPst;
}
public void setMainPriceRentPst(String mainPriceRentPst) {
this.mainPriceRentPst = mainPriceRentPst;
}
public String getMainPriceType() {
return mainPriceType;
}
public void setMainPriceType(String mainPriceType) {
this.mainPriceType = mainPriceType;
}
public String getMainPriceRentType() {
return mainPriceRentType;
}
public void setMainPriceRentType(String mainPriceRentType) {
this.mainPriceRentType = mainPriceRentType;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public Boolean getStandardBuilding() {
return isStandardBuilding;
}
public void setStandardBuilding(Boolean standardBuilding) {
isStandardBuilding = standardBuilding;
}
public String getAdjustPriceComment() {
return adjustPriceComment;
}
public void setAdjustPriceComment(String adjustPriceComment) {
this.adjustPriceComment = adjustPriceComment;
}
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;
public void setLastValuePoint(Date lastValuePoint) {
this.lastValuePoint = lastValuePoint;
}
}

View File

@ -4,159 +4,167 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 请填写功能名称对象 office_base_price_ultimate
* 计算的住宅小区售价
*
* @author ruoyi
* @date 2020-05-20
*/
public class ComputeResidenceSaleBasePrice extends BaseEntity {
private Integer pageIndex;
private Integer pageSize;
@JSONField(serialize = false)
private Integer yearMonth;
@JSONField(serialize = false)
private String nameOrAddress;
@Excel(name = "ID")
private String id;
@Excel(name = "楼栋ID")
private String buildingId;
@Excel(name = "小区ID")
@Excel(name = "AI小区ID")
private String communityId;
@Excel(name = "主力基价")
private String mainPrice;
@Excel(name = "主力租金")
private String mainPriceRent;
@Excel(name = "主力基价涨跌幅")
private String mainPricePst;
@Excel(name = "主力租金涨跌幅")
private String mainPriceRentPst;
@Excel(name = "主力基价类型")
private String mainPriceType;
@Excel(name = "主力租金类型")
private String mainPriceRentType;
@Excel(name = "更新日期")
private Date updateDate;
@Excel(name = "状态")
private Boolean status;
@Excel(name = "是否标准楼栋")
private Boolean isStandardBuilding;
@Excel(name = "更改价格说明")
private String adjustPriceComment;
@Excel(name = "小区名称")
private String communityName;
@Excel(name = "小区地址")
private String communityAddress;
@Excel(name = "区域")
private String countyName;
@Excel(name = "板块")
private String blockName;
@Excel(name = "环线")
private String loopName;
@Excel(name = "是否生成索引")
private Integer hasIndex;
@Excel(name = "参与涨幅计算")
private Integer isPstCalc;
@Excel(name = "运行状态")
private Integer status;
@Excel(name = "特殊小区标签")
private String label;
@Excel(name = "物业类型")
private String propertyType;
@Excel(name = "小区类型")
private String projectType;
@Excel(name = "小区类型细分")
private String projectTypeDtl;
@Excel(name = "物业档次")
private String propertyLevel;
@Excel(name = "建成年代")
private Integer year;
@Excel(name = "主力面积")
private BigDecimal area;
@Excel(name = "房屋面积系数")
private BigDecimal areaCoefficient;
@Excel(name = "建成年代系数")
private BigDecimal yearCoefficient;
@Excel(name = "价格说明")
private String comment;
@Excel(name = "AI基价(草稿)")
private BigDecimal basePriceDraft;
@Excel(name = "主力基价(草稿)")
private BigDecimal mainPriceDraft;
@Excel(name = "上月AI基价")
private BigDecimal basePrice_1;
@Excel(name = "价格涨跌幅类型-调整后")
private String voppat;
@Excel(name = "价格涨跌幅-调整后")
private BigDecimal voppa;
@Excel(name = "案例均价")
private BigDecimal priceUnitAdj;
/**
* 累计带看
*/
@Excel(name = "平均访客数量")
private Integer visitedNum;
/**
* 首次带看日
*/
@Excel(name = "首次看房时间")
private Date firstVisitTime;
/**
* 近15日带看
*/
@Excel(name = "15天内平均访客数量")
private Integer visitedNum15;
/**
* 近30天带看
*/
@Excel(name = "30天内平均访客数量")
private Integer visitedNum30;
@Excel(name = "成交均价(上周期)")
private BigDecimal priceDealMean_1;
@Excel(name = "成交最大价(上周期)")
private BigDecimal priceDealMax_1;
@Excel(name = "成交数量(上周期)")
private Integer sumDeal_1;
@Excel(name = "成交均价")
private BigDecimal priceDealMean;
@Excel(name = "成交最大价")
private BigDecimal priceDealMax;
@Excel(name = "成交数量")
private Integer sumDeal;
public String getId() {
return id;
}
@Excel(name = "挂牌最低价")
private Integer priceListedMin;
@Excel(name = "与上月AI基价链家1案例价格价调整比例")
private BigDecimal priceCase1_ToAI_Pst;
@Excel(name = "与上月AI基价链家2案例价格价调整比例")
private BigDecimal priceCase2_ToAI_Pst;
@Excel(name = "当月比上月链1案例价调整比例")
private BigDecimal priceCase1_ToLst_Pst;
@Excel(name = "当月比上月链2案例价调整比例")
private BigDecimal priceCase2_ToLst_Pst;
public void setId(String id) {
this.id = id;
}
@Excel(name = "链家1案例价")
private BigDecimal priceCase1;
@Excel(name = "链家1调价幅度")
private BigDecimal priceCase1AdjPst;
@Excel(name = "链家1案例总量")
private Integer sumCase1;
@Excel(name = "链家2案例价")
private BigDecimal priceCase2;
@Excel(name = "链家2调价幅度")
private BigDecimal priceCase2AdjPst;
@Excel(name = "链家2案例总量")
private Integer sumCase2;
public Integer getYearMonth() {
return yearMonth;
}
@Excel(name = "价格涨跌幅类型-调整前")
private String voppbt;
@Excel(name = "价格涨跌幅-调整前")
private BigDecimal voppb;
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getMainPrice() {
return mainPrice;
}
public void setMainPrice(String mainPrice) {
this.mainPrice = mainPrice;
}
public String getMainPriceRent() {
return mainPriceRent;
}
public void setMainPriceRent(String mainPriceRent) {
this.mainPriceRent = mainPriceRent;
}
public String getMainPricePst() {
return mainPricePst;
}
public void setMainPricePst(String mainPricePst) {
this.mainPricePst = mainPricePst;
}
public String getMainPriceRentPst() {
return mainPriceRentPst;
}
public void setMainPriceRentPst(String mainPriceRentPst) {
this.mainPriceRentPst = mainPriceRentPst;
}
public String getMainPriceType() {
return mainPriceType;
}
public void setMainPriceType(String mainPriceType) {
this.mainPriceType = mainPriceType;
}
public String getMainPriceRentType() {
return mainPriceRentType;
}
public void setMainPriceRentType(String mainPriceRentType) {
this.mainPriceRentType = mainPriceRentType;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public Boolean getStandardBuilding() {
return isStandardBuilding;
}
public void setStandardBuilding(Boolean standardBuilding) {
isStandardBuilding = standardBuilding;
}
public String getAdjustPriceComment() {
return adjustPriceComment;
}
public void setAdjustPriceComment(String adjustPriceComment) {
this.adjustPriceComment = adjustPriceComment;
}
@Excel(name = "绑定小区编号")
// BindProjID
private String bindCommunityId;
@Excel(name = "绑定小区涨跌幅")
// Bind_Proj_Pst
private BigDecimal bindCommunityPst;
@Excel(name = "绑定板块+聚类ID")
// Bind_Block_Class
private String bindBlockClass;
@Excel(name = "绑定板块+聚类ID的涨跌幅")
// Bind_Block_Class_Pst
private BigDecimal bindBlockClassPst;
@Excel(name = "绑定板块+物业档次")
// Bind_Block_Plevel
private String bindBlockPropertyLevel;
@Excel(name = "绑定板块+物业档次的涨跌幅")
// Bind_Block_Plevel_Pst
private BigDecimal bindBlockPropertyLevelPst;
@Excel(name = "绑定板块+小区类型")
// Bind_Block_PType
private String bindBlockProjectType;
@Excel(name = "绑定板块+小区类型的涨跌幅")
// Bind_Block_Ptype_Pst
private BigDecimal bindBlockProjectTypePst;
@Excel(name = "绑定区县+小区类型")
// Bind_County_PType
private String bindCountyProjectType;
@Excel(name = "绑定区县+小区类型的涨跌幅")
// Bind_County_PType_Pst
private BigDecimal bindCountyProjectTypePst;
public Integer getPageIndex() {
return pageIndex;
@ -173,4 +181,494 @@ public class ComputeResidenceSaleBasePrice extends BaseEntity {
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getYearMonth() {
return yearMonth;
}
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getCommunityName() {
return communityName;
}
public void setCommunityName(String communityName) {
this.communityName = communityName;
}
public String getCommunityAddress() {
return communityAddress;
}
public void setCommunityAddress(String communityAddress) {
this.communityAddress = communityAddress;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public String getBlockName() {
return blockName;
}
public void setBlockName(String blockName) {
this.blockName = blockName;
}
public String getLoopName() {
return loopName;
}
public void setLoopName(String loopName) {
this.loopName = loopName;
}
public Integer getHasIndex() {
return hasIndex;
}
public void setHasIndex(Integer hasIndex) {
this.hasIndex = hasIndex;
}
public Integer getIsPstCalc() {
return isPstCalc;
}
public void setIsPstCalc(Integer isPstCalc) {
this.isPstCalc = isPstCalc;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getPropertyType() {
return propertyType;
}
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
public String getProjectType() {
return projectType;
}
public void setProjectType(String projectType) {
this.projectType = projectType;
}
public String getProjectTypeDtl() {
return projectTypeDtl;
}
public void setProjectTypeDtl(String projectTypeDtl) {
this.projectTypeDtl = projectTypeDtl;
}
public String getPropertyLevel() {
return propertyLevel;
}
public void setPropertyLevel(String propertyLevel) {
this.propertyLevel = propertyLevel;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public BigDecimal getArea() {
return area;
}
public void setArea(BigDecimal area) {
this.area = area;
}
public BigDecimal getAreaCoefficient() {
return areaCoefficient;
}
public void setAreaCoefficient(BigDecimal areaCoefficient) {
this.areaCoefficient = areaCoefficient;
}
public BigDecimal getYearCoefficient() {
return yearCoefficient;
}
public void setYearCoefficient(BigDecimal yearCoefficient) {
this.yearCoefficient = yearCoefficient;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public BigDecimal getBasePriceDraft() {
return basePriceDraft;
}
public void setBasePriceDraft(BigDecimal basePriceDraft) {
this.basePriceDraft = basePriceDraft;
}
public BigDecimal getMainPriceDraft() {
return mainPriceDraft;
}
public void setMainPriceDraft(BigDecimal mainPriceDraft) {
this.mainPriceDraft = mainPriceDraft;
}
public BigDecimal getBasePrice_1() {
return basePrice_1;
}
public void setBasePrice_1(BigDecimal basePrice_1) {
this.basePrice_1 = basePrice_1;
}
public BigDecimal getPriceUnitAdj() {
return priceUnitAdj;
}
public void setPriceUnitAdj(BigDecimal priceUnitAdj) {
this.priceUnitAdj = priceUnitAdj;
}
public Integer getVisitedNum() {
return visitedNum;
}
public void setVisitedNum(Integer visitedNum) {
this.visitedNum = visitedNum;
}
public Date getFirstVisitTime() {
return firstVisitTime;
}
public void setFirstVisitTime(Date firstVisitTime) {
this.firstVisitTime = firstVisitTime;
}
public Integer getVisitedNum15() {
return visitedNum15;
}
public void setVisitedNum15(Integer visitedNum15) {
this.visitedNum15 = visitedNum15;
}
public Integer getVisitedNum30() {
return visitedNum30;
}
public void setVisitedNum30(Integer visitedNum30) {
this.visitedNum30 = visitedNum30;
}
public BigDecimal getPriceDealMean_1() {
return priceDealMean_1;
}
public void setPriceDealMean_1(BigDecimal priceDealMean_1) {
this.priceDealMean_1 = priceDealMean_1;
}
public BigDecimal getPriceDealMax_1() {
return priceDealMax_1;
}
public void setPriceDealMax_1(BigDecimal priceDealMax_1) {
this.priceDealMax_1 = priceDealMax_1;
}
public Integer getSumDeal_1() {
return sumDeal_1;
}
public void setSumDeal_1(Integer sumDeal_1) {
this.sumDeal_1 = sumDeal_1;
}
public BigDecimal getPriceDealMean() {
return priceDealMean;
}
public void setPriceDealMean(BigDecimal priceDealMean) {
this.priceDealMean = priceDealMean;
}
public BigDecimal getPriceDealMax() {
return priceDealMax;
}
public void setPriceDealMax(BigDecimal priceDealMax) {
this.priceDealMax = priceDealMax;
}
public Integer getSumDeal() {
return sumDeal;
}
public void setSumDeal(Integer sumDeal) {
this.sumDeal = sumDeal;
}
public Integer getPriceListedMin() {
return priceListedMin;
}
public void setPriceListedMin(Integer priceListedMin) {
this.priceListedMin = priceListedMin;
}
public BigDecimal getPriceCase1_ToAI_Pst() {
return priceCase1_ToAI_Pst;
}
public void setPriceCase1_ToAI_Pst(BigDecimal priceCase1_ToAI_Pst) {
this.priceCase1_ToAI_Pst = priceCase1_ToAI_Pst;
}
public BigDecimal getPriceCase2_ToAI_Pst() {
return priceCase2_ToAI_Pst;
}
public void setPriceCase2_ToAI_Pst(BigDecimal priceCase2_ToAI_Pst) {
this.priceCase2_ToAI_Pst = priceCase2_ToAI_Pst;
}
public BigDecimal getPriceCase1_ToLst_Pst() {
return priceCase1_ToLst_Pst;
}
public void setPriceCase1_ToLst_Pst(BigDecimal priceCase1_ToLst_Pst) {
this.priceCase1_ToLst_Pst = priceCase1_ToLst_Pst;
}
public BigDecimal getPriceCase2_ToLst_Pst() {
return priceCase2_ToLst_Pst;
}
public void setPriceCase2_ToLst_Pst(BigDecimal priceCase2_ToLst_Pst) {
this.priceCase2_ToLst_Pst = priceCase2_ToLst_Pst;
}
public BigDecimal getPriceCase1() {
return priceCase1;
}
public void setPriceCase1(BigDecimal priceCase1) {
this.priceCase1 = priceCase1;
}
public BigDecimal getPriceCase1AdjPst() {
return priceCase1AdjPst;
}
public void setPriceCase1AdjPst(BigDecimal priceCase1AdjPst) {
this.priceCase1AdjPst = priceCase1AdjPst;
}
public Integer getSumCase1() {
return sumCase1;
}
public void setSumCase1(Integer sumCase1) {
this.sumCase1 = sumCase1;
}
public BigDecimal getPriceCase2() {
return priceCase2;
}
public void setPriceCase2(BigDecimal priceCase2) {
this.priceCase2 = priceCase2;
}
public BigDecimal getPriceCase2AdjPst() {
return priceCase2AdjPst;
}
public void setPriceCase2AdjPst(BigDecimal priceCase2AdjPst) {
this.priceCase2AdjPst = priceCase2AdjPst;
}
public Integer getSumCase2() {
return sumCase2;
}
public void setSumCase2(Integer sumCase2) {
this.sumCase2 = sumCase2;
}
public String getVoppbt() {
return voppbt;
}
public void setVoppbt(String voppbt) {
this.voppbt = voppbt;
}
public String getBindCommunityId() {
return bindCommunityId;
}
public void setBindCommunityId(String bindCommunityId) {
this.bindCommunityId = bindCommunityId;
}
public BigDecimal getBindCommunityPst() {
return bindCommunityPst;
}
public void setBindCommunityPst(BigDecimal bindCommunityPst) {
this.bindCommunityPst = bindCommunityPst;
}
public String getBindBlockClass() {
return bindBlockClass;
}
public void setBindBlockClass(String bindBlockClass) {
this.bindBlockClass = bindBlockClass;
}
public BigDecimal getBindBlockClassPst() {
return bindBlockClassPst;
}
public void setBindBlockClassPst(BigDecimal bindBlockClassPst) {
this.bindBlockClassPst = bindBlockClassPst;
}
public String getBindBlockPropertyLevel() {
return bindBlockPropertyLevel;
}
public void setBindBlockPropertyLevel(String bindBlockPropertyLevel) {
this.bindBlockPropertyLevel = bindBlockPropertyLevel;
}
public BigDecimal getBindBlockPropertyLevelPst() {
return bindBlockPropertyLevelPst;
}
public void setBindBlockPropertyLevelPst(BigDecimal bindBlockPropertyLevelPst) {
this.bindBlockPropertyLevelPst = bindBlockPropertyLevelPst;
}
public String getBindBlockProjectType() {
return bindBlockProjectType;
}
public void setBindBlockProjectType(String bindBlockProjectType) {
this.bindBlockProjectType = bindBlockProjectType;
}
public BigDecimal getBindBlockProjectTypePst() {
return bindBlockProjectTypePst;
}
public void setBindBlockProjectTypePst(BigDecimal bindBlockProjectTypePst) {
this.bindBlockProjectTypePst = bindBlockProjectTypePst;
}
public String getBindCountyProjectType() {
return bindCountyProjectType;
}
public void setBindCountyProjectType(String bindCountyProjectType) {
this.bindCountyProjectType = bindCountyProjectType;
}
public BigDecimal getBindCountyProjectTypePst() {
return bindCountyProjectTypePst;
}
public void setBindCountyProjectTypePst(BigDecimal bindCountyProjectTypePst) {
this.bindCountyProjectTypePst = bindCountyProjectTypePst;
}
public String getVoppat() {
return voppat;
}
public void setVoppat(String voppat) {
this.voppat = voppat;
}
public BigDecimal getVoppa() {
return voppa;
}
public void setVoppa(BigDecimal voppa) {
this.voppa = voppa;
}
public BigDecimal getVoppb() {
return voppb;
}
public void setVoppb(BigDecimal voppb) {
this.voppb = voppb;
}
public String getNameOrAddress() {
return nameOrAddress;
}
public void setNameOrAddress(String nameOrAddress) {
this.nameOrAddress = nameOrAddress;
}
}

View File

@ -6,7 +6,7 @@ import com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice;
import java.util.List;
/**
* 请填写功能名称Mapper接口
* Mapper接口
*
* @author ruoyi
* @date 2020-05-20

View File

@ -0,0 +1,96 @@
package com.ruoyi.project.data.price.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("compute")
public interface ArtificialResidenceSaleBasePriceMapper {
/**
* @param id
* @return
*/
ArtificialResidenceSaleBasePrice selectById(String id);
/**
* 新增
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int insert(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 新增价格插入至基价库
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int insertUVBasePrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 批量插入
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int insertUVDocument(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 修改上期价格
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int updateLastMonthPrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 创建用于批量导入的存储过程
*
* @param yearMonth
* @return
*/
int prepareBachImport(@Param("yearMonth") Integer yearMonth);
// /**
// * 修改数据
// *
// * @param artificialResidenceSaleBasePrice
// * @return
// */
// int updatePrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 分页列表
*
* @param artificialResidenceSaleBasePrice
* @return
*/
List<ArtificialResidenceSaleBasePrice> selectPageList(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 分页总数
*
* @param artificialResidenceSaleBasePrice
* @return
*/
Integer selectPageCount(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 更新
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int updateEntity(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* @return
*/
List<VueSelectModel> yearMonthList();
}

View File

@ -6,12 +6,7 @@ import com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice;
import java.util.List;
/**
* 请填写功能名称Mapper接口
*
* @author ruoyi
* @date 2020-05-20
*/
@DS("compute")
public interface ComputeResidenceRentPriceMapper {

View File

@ -0,0 +1,32 @@
package com.ruoyi.project.data.price.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import java.util.List;
@DS("compute")
public interface ComputeResidenceSalePriceMapper {
/**
* 分页列表
*
* @param computeResidenceSaleBasePrice
* @return
*/
List<ComputeResidenceSaleBasePrice> selectPageList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice);
/**
* 分页总数
*
* @param computeResidenceSaleBasePrice
* @return
*/
Integer selectPageCount(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice);
/**
* @return
*/
List<VueSelectModel> yearMonthList();
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.project.data.price.service;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import java.util.List;
/**
* 人工修正住宅基价
*/
public interface IArtificialResidenceSalePriceService {
/**
* 单个
*
* @param id
* @return
*/
ArtificialResidenceSaleBasePrice selectById(String id);
/**
* 分页列表
*
* @param artificialResidenceSaleBasePrice
* @return 集合
*/
List<ArtificialResidenceSaleBasePrice> selectList(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 分页数量
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int selectCount(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 获取表名
*
* @return
*/
List<VueSelectModel> getYearMonth();
/**
* 更新
*
* @param artificialResidenceSaleBasePrice
* @return
*/
int updateEntity(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 导入
*
* @param yearMonth
* @param list
* @return
*/
String batchImport(Integer yearMonth, List<ComputeResidenceSaleBasePrice> list);
}

View File

@ -0,0 +1,39 @@
package com.ruoyi.project.data.price.service;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import java.util.List;
/**
* 计算住宅基价
*/
public interface IOriginalResidenceSalePriceService {
/**
* 查询列表
*
* @param computeResidenceSaleBasePrice
* @return 集合
*/
List<ComputeResidenceSaleBasePrice> selectList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice);
/**
* @param computeResidenceSaleBasePrice
* @return
*/
int selectCount(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice);
/**
* 获取表名
*
* @return
*/
List<VueSelectModel> getYearMonth();
}

View File

@ -0,0 +1,276 @@
package com.ruoyi.project.data.price.service.impl;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.microsoft.sqlserver.jdbc.*;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.datasource.DynamicDataSource;
import com.ruoyi.project.common.UVResponse;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import com.ruoyi.project.data.price.mapper.ArtificialResidenceSaleBasePriceMapper;
import com.ruoyi.project.data.price.mapper.ComputeResidenceSalePriceMapper;
import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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.stereotype.Service;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.web.client.RestTemplate;
import javax.sql.DataSource;
import java.sql.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 计算住宅基价Service业务层处理
*
* @author ruoyi
* @date 2020-05-20
*/
@Service
@DS("compute")
public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResidenceSalePriceService {
private static final Logger log = LoggerFactory.getLogger(ArtificialResidenceSalePriceServiceImpl.class);
@Autowired
private ArtificialResidenceSaleBasePriceMapper artificialResidenceSaleBasePriceMapper;
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private TransactionTemplate transactionTemplate;
@Override
public List<ArtificialResidenceSaleBasePrice> selectList(ArtificialResidenceSaleBasePrice computeResidenceSaleBasePrice) {
return artificialResidenceSaleBasePriceMapper.selectPageList(computeResidenceSaleBasePrice);
}
@Override
public int selectCount(ArtificialResidenceSaleBasePrice computeResidenceSaleBasePrice) {
return artificialResidenceSaleBasePriceMapper.selectPageCount(computeResidenceSaleBasePrice);
}
@Override
public List<VueSelectModel> getYearMonth() {
return artificialResidenceSaleBasePriceMapper.yearMonthList();
}
@Override
public ArtificialResidenceSaleBasePrice selectById(String id) {
return artificialResidenceSaleBasePriceMapper.selectById(id);
}
@Override
public int updateEntity(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice) {
return artificialResidenceSaleBasePriceMapper.updateEntity(artificialResidenceSaleBasePrice);
}
@Override
// @Transactional
public String batchImport(Integer yearMonth, List<ComputeResidenceSaleBasePrice> list) {
int successNum = list.size();
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
Calendar calendar = Calendar.getInstance();
calendar.set(yearMonth / 100, (yearMonth % 100) - 1, 1);
Date valuePoint = calendar.getTime();
calendar.add(Calendar.MONTH, -1);
Date lastValuePoint = calendar.getTime();
artificialResidenceSaleBasePriceMapper.prepareBachImport(yearMonth);
CopyOnWriteArrayList<ArtificialResidenceSaleBasePrice> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
list.parallelStream().forEach(inputModel -> {
ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice =
new ArtificialResidenceSaleBasePrice();
BeanUtils.copyProperties(inputModel,
artificialResidenceSaleBasePrice);
artificialResidenceSaleBasePrice.setYearMonth(yearMonth);
artificialResidenceSaleBasePrice.setPriceId(UUID.randomUUID().toString());
artificialResidenceSaleBasePrice.setValuePoint(valuePoint);
artificialResidenceSaleBasePrice.setLastValuePoint(lastValuePoint);
copyOnWriteArrayList.add(artificialResidenceSaleBasePrice);
});
try {
// 声明变量
// 构造一个
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute";
String name = "sa";
String pwd = "Lcdatacenter_888";
Class.forName(driverName);
Connection conn = DriverManager.getConnection(dbURL, name, pwd);
SQLServerDataTable sourceDataTable = new SQLServerDataTable();
sourceDataTable.addColumnMetadata("communityId", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("communityName", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("communityAddress", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("countyName", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("blockName", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("loopName", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("hasIndex", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("isPstCalc", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("status", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("label", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("propertyType", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("projectType", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("projectTypeDtl", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("propertyLevel", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("year", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("area", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("areaCoefficient", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("yearCoefficient", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("comment", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("basePriceDraft", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("mainPriceDraft", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("basePrice_1", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("voppat", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("voppa", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceUnitAdj", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("visitedNum", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("firstVisitTime", java.sql.Types.DATE);
sourceDataTable.addColumnMetadata("visitedNum15", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("visitedNum30", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("priceDealMean_1", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceDealMax_1", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("sumDeal_1", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("priceDealMean", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceDealMax", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("sumDeal", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("priceListedMin", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("priceCase1_ToAI_Pst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceCase2_ToAI_Pst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceCase1_ToLst_Pst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceCase2_ToLst_Pst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceCase1", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceCase1AdjPst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("sumCase1", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("priceCase2", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("priceCase2AdjPst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("sumCase2", java.sql.Types.INTEGER);
sourceDataTable.addColumnMetadata("voppbt", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("voppb", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("bindCommunityId", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("bindCommunityPst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("bindBlockClass", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("bindBlockClassPst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("bindBlockPropertyLevel", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("bindBlockPropertyLevelPst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("bindBlockProjectType", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("bindBlockProjectTypePst", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("bindCountyProjectType", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("bindCountyProjectTypePst", java.sql.Types.DECIMAL);
copyOnWriteArrayList.forEach(x -> {
try {
sourceDataTable.addRow(
x.getCommunityId(),
x.getCommunityName(),
x.getCommunityAddress(),
x.getCountyName(),
x.getBlockName(),
x.getLoopName(),
x.getHasIndex(),
x.getIsPstCalc(),
x.getStatus(),
x.getLabel(),
x.getPropertyType(),
x.getProjectType(),
x.getProjectTypeDtl(),
x.getPropertyLevel(),
x.getYear(),
x.getArea(),
x.getYearCoefficient(),
x.getAreaCoefficient(),
x.getComment(),
x.getBasePriceDraft(),
x.getMainPriceDraft(),
x.getBasePrice_1(),
x.getVoppat(),
x.getVoppa(),
x.getPriceUnitAdj(),
x.getVisitedNum(),
x.getFirstVisitTime(),
x.getVisitedNum15(),
x.getVisitedNum30(),
x.getPriceDealMean_1(),
x.getPriceDealMax_1(),
x.getSumDeal_1(),
x.getPriceDealMean(),
x.getPriceDealMax(),
x.getSumDeal(),
x.getPriceListedMin(),
x.getPriceCase1_ToAI_Pst(),
x.getPriceCase2_ToAI_Pst(),
x.getPriceCase1_ToLst_Pst(),
x.getPriceCase2_ToLst_Pst(),
x.getPriceCase1(),
x.getPriceCase1AdjPst(),
x.getSumCase1(),
x.getPriceCase2(),
x.getPriceCase2AdjPst(),
x.getSumCase2(),
x.getVoppbt(),
x.getVoppb(),
x.getBindCommunityId(),
x.getBindCommunityPst(),
x.getBindBlockClass(),
x.getBindBlockClassPst(),
x.getBindBlockPropertyLevel(),
x.getBindBlockPropertyLevelPst(),
x.getBindBlockProjectType(),
x.getBindBlockProjectTypePst(),
x.getBindCountyProjectType(),
x.getBindCountyProjectTypePst()
);
} catch (SQLServerException e) {
e.printStackTrace();
}
});
Statement statement = conn.createStatement();
try (CallableStatement cs = conn.prepareCall("{CALL dbo.BatchImportOfArtificialResidenceSale (?)}")) {
((SQLServerCallableStatement) cs).setStructured(1, "dbo.DWA_PROJECTBASEPRICE_MANU_Table",
sourceDataTable);
boolean resultSetReturned = cs.execute();
if (resultSetReturned) {
try (ResultSet rs = cs.getResultSet()) {
rs.next();
System.out.println(rs.getInt(1));
}
}
}
// 删除存储过程还原环境
statement.execute("drop procedure BatchImportOfArtificialResidenceSale");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
StringBuilder successMsg = new StringBuilder("恭喜您,数据已全部导入成功!共 " + (successNum - failureNum) + "");
return successMsg.toString();
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.project.data.price.service.impl;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import com.ruoyi.project.data.price.mapper.ComputeResidenceSalePriceMapper;
import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 计算住宅基价Service业务层处理
*
* @author ruoyi
* @date 2020-05-20
*/
@Service
public class OriginalResidenceSalePriceServiceImpl implements IOriginalResidenceSalePriceService {
private static final Logger log = LoggerFactory.getLogger(OriginalResidenceSalePriceServiceImpl.class);
@Autowired
private ComputeResidenceSalePriceMapper computeResidenceSalePriceMapper;
@Override
public List<ComputeResidenceSaleBasePrice> selectList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice) {
return computeResidenceSalePriceMapper.selectPageList(computeResidenceSaleBasePrice);
}
@Override
public int selectCount(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice) {
return computeResidenceSalePriceMapper.selectPageCount(computeResidenceSaleBasePrice);
}
@Override
public List<VueSelectModel> getYearMonth() {
return computeResidenceSalePriceMapper.yearMonthList();
}
}

View File

@ -26,6 +26,11 @@ spring:
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
username: sa
password: Lcdatacenter_888
oldProd:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://139.196.201.83:8433;DatabaseName=LC_DataCenter
username: sa
password: lc1234
compute:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute
@ -36,6 +41,11 @@ spring:
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean
username: sa
password: Lcdatacenter_888
calc:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=CALC
username: purple
password: liancheng
# druid:
# statViewServlet:

View File

@ -32,10 +32,15 @@ server:
min-spare-threads: 30
# 日志配置
#logging:
# level:
# com.ruoyi: debug
# org.springframework: warn
logging:
level:
com.ruoyi: debug
org.springframework: warn
root: debug
path: C:\workshop\logs\ruoyi\
config: classpath:logback-spring.xml
# Spring配置
spring:

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>uv-data</contextName>
<!-- name的值是变量的名称value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后可以使“${}”来使用变量。 -->
<springProperty scope="context" name="logging.path" source="logging.path"/>
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用只配置最底级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logging.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${logging.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logging.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${logging.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logging.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logging.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logging.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logging.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<springProfile name="dev">
<!-- <logger name="com.apache.ibatis" level="DEBUG"/>-->
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="com.ruoyi" level="info"/>
</springProfile>
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</configuration>

View File

@ -0,0 +1,429 @@
<?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.price.mapper.ArtificialResidenceSaleBasePriceMapper">
<resultMap type="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice"
id="MainMappingResult">
<result property="communityId" column="ProjectID"/>
<result property="communityName" column="ProjectName"/>
<result property="communityAddress" column="ProjectAddr"/>
<result property="countyName" column="county"/>
<result property="blockName" column="block"/>
<result property="loopName" column="loop"/>
<result property="hasIndex" column="isIndxGen"/>
<result property="isPstCalc" column="isPstCalc"/>
<result property="status" column="statusRun"/>
<result property="label" column="ProjectSPLabel"/>
<result property="propertyType" column="propertyType"/>
<result property="projectType" column="projectType"/>
<result property="projectTypeDtl" column="projectTypeDtl"/>
<result property="propertyLevel" column="projectLevel"/>
<result property="year" column="year"/>
<result property="area" column="mainArea"/>
<result property="yearCoefficient" column="yearCoff"/>
<result property="areaCoefficient" column="areaCoff"/>
<result property="comment" column="priceNote"/>
<result property="basePriceDraft" column="basePriceDft"/>
<result property="mainPriceDraft" column="mainPriceDft"/>
<result property="basePrice_1" column="basePrice_1"/>
<result property="voppat" column="voppat"/>
<result property="voppa" column="voppa"/>
<!-- 案例均价 -->
<result property="priceUnitAdj" column="PriceUnitAdj"/>
<result property="visitedNum" column="Visited_Num"/>
<result property="firstVisitTime" column="First_Visit_Time"/>
<result property="visitedNum15" column="Visited_Num_15"/>
<result property="visitedNum30" column="Visited_Num_30"/>
<!-- 上周期 -->
<result property="priceDealMean_1" column="priceDealMean_1"/>
<result property="priceDealMax_1" column="priceDealMax_1"/>
<result property="sumDeal_1" column="sumDeal_1"/>
<!-- 本周期 -->
<result property="priceDealMean" column="priceDealMean"/>
<result property="priceDealMax" column="priceDealMax"/>
<result property="sumDeal" column="sumDeal"/>
<!-- 挂牌最低价 -->
<result property="priceListedMin" column="priceListedMin"/>
<result property="priceCase1_ToAI_Pst" column="priceCase1_ToAI_Pst"/>
<result property="priceCase2_ToAI_Pst" column="priceCase2_ToAI_Pst"/>
<result property="priceCase1_ToLst_Pst" column="priceCase1_ToLst_Pst"/>
<result property="priceCase2_ToLst_Pst" column="priceCase2_ToLst_Pst"/>
<result property="priceCase1" column="priceCase1"/>
<result property="priceCase1AdjPst" column="priceCase1AdjPst"/>
<result property="sumCase1" column="sumCase1"/>
<result property="priceCase2" column="priceCase2"/>
<result property="priceCase2AdjPst" column="priceCase2AdjPst"/>
<result property="sumCase2" column="sumCase2"/>
<result property="voppbt" column="voppbt"/>
<result property="voppb" column="voppb"/>
<!-- 绑定小区相关信息 -->
<result property="bindCommunityId" column="bindProjID"/>
<result property="bindCommunityPst" column="bind_Proj_Pst"/>
<result property="bindBlockClass" column="bind_Block_Class"/>
<result property="bindBlockClassPst" column="bind_Block_Class_Pst"/>
<result property="bindBlockPropertyLevel" column="bind_Block_Plevel"/>
<result property="bindBlockPropertyLevelPst" column="bind_Block_Plevel_Pst"/>
<result property="bindBlockProjectType" column="bind_Block_PType"/>
<result property="bindBlockProjectTypePst" column="bind_Block_Ptype_Pst"/>
<result property="bindCountyProjectType" column="bind_County_PType"/>
<result property="bindCountyProjectTypePst" column="bind_County_Ptype_Pst"/>
</resultMap>
<sql id="selectAllField">
SELECT ProjectID
,ProjectName
,ProjectAddr
,County
,Block
,"Loop"
,IsIndxGen
,IsPstCalc
,StatusRun
,ProjectSPLabel
,PropertyType
,ProjectType
,ProjectTypeDtl
,ProjectLevel
,Year
,MainArea
,AreaCoff
,YearCoff
,PriceNote
,BasePriceDft
,MainPriceDft
,BasePrice_1
,PriceUnitAdj
,Visited_Num
,First_Visit_Time
,Visited_Num_15
,Visited_Num_30
,PriceDealMean_1
,PriceDealMax_1
,SumDeal_1
,PriceDealMean
,PriceDealMax
,SumDeal
,PriceListedMin
,PriceCase1_ToAI_Pst
,PriceCase2_ToAI_Pst
,PriceCase1_ToLst_Pst
,PriceCase2_ToLst_Pst
,PriceCase1
,PriceCase1AdjPst
,SumCase1
,PriceCase2
,PriceCase2AdjPst
,SumCase2
,VOPPBT
,VOPPB
,BindProjID
,Bind_Proj_Pst
,Bind_Block_Class
,Bind_Block_Class_Pst
,Bind_Block_Plevel
,Bind_Block_Plevel_Pst
,Bind_Block_PType
,Bind_Block_Ptype_Pst
,Bind_County_PType
,Bind_County_Ptype_Pst
,VOPPAT
,VOPPA
FROM dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth}
</sql>
<!-- 分页总数 -->
<select id="selectPageCount"
parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice" resultType="int">
select count(1) from dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth}
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
</if>
<if test="nameOrAddress != null">
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%',
#{nameOrAddress}, '%'))
</if>
</where>
</select>
<!-- 分页列表 -->
<select id="selectPageList"
parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice"
resultMap="MainMappingResult">
<include refid="selectAllField"/>
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
</if>
<if test="nameOrAddress != null">
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%',
#{nameOrAddress}, '%'))
</if>
</where>
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
</select>
<!-- -->
<select id="selectById" parameterType="String" resultMap="MainMappingResult">
<include refid="selectAllField"/>
where id = #{id}
</select>
<!-- 获取表名 -->
<select id="yearMonthList" resultType="com.ruoyi.project.common.VueSelectModel">
SELECT right(name,6) as value, right(name,6) as label
FROM sys.tables
where name like 'DWA_PROJECTBASEPRICE_MANU_%'
order by cast(right(name,6) as int) desc
</select>
<!-- 修改价格信息(基价、主力基价、上月基价、幅度)、注意修改上期基价问题、还要把基价更新一下。 -->
<update id="updateEntity" parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice">
update dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth} set
BasePrice=#{basePrice},mainPrice=#{mainPrice},BasePrice_1=#{basePrice_1},VOPPAT=#{voppat},VOPPA=#{voppa},
PriceNote=#{comment}
where ProjectID=#{communityId};
</update>
<update id="prepareBachImport" parameterType="int">
create procedure dbo.BatchImportOfArtificialResidenceSale @table DWA_PROJECTBASEPRICE_MANU_Table readonly
as
begin
insert into dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth} ( ProjectID , ProjectName , ProjectAddr , County ,
Block ,
Loop , IsIndxGen , IsPstCalc , StatusRun , ProjectSPLabel , PropertyType , ProjectType , ProjectTypeDtl , ProjectLevel , Year , MainArea , AreaCoff , YearCoff , PriceNote , BasePriceDft , MainPriceDft , BasePrice_1 , PriceUnitAdj , Visited_Num , First_Visit_Time , Visited_Num_15 , Visited_Num_30 , PriceDealMean_1 , PriceDealMax_1 , SumDeal_1 , PriceDealMean , PriceDealMax , SumDeal , PriceListedMin , PriceCase1_ToAI_Pst , PriceCase2_ToAI_Pst , PriceCase1_ToLst_Pst , PriceCase2_ToLst_Pst , PriceCase1 , PriceCase1AdjPst , SumCase1 , PriceCase2 , PriceCase2AdjPst , SumCase2 , VOPPBT , VOPPB , BindProjID , Bind_Proj_Pst , Bind_Block_Class , Bind_Block_Class_Pst , Bind_Block_Plevel , Bind_Block_Plevel_Pst , Bind_Block_PType , Bind_Block_Ptype_Pst , Bind_County_PType , Bind_County_Ptype_Pst , VOPPAT , VOPPA )
select communityId , communityName , communityAddress , countyName , blockName , loopName , hasIndex , IsPstCalc , status , label , PropertyType , ProjectType , ProjectTypeDtl , propertyLevel , Year , area , areaCoefficient , yearCoefficient , comment , basePriceDraft , mainPriceDraft , BasePrice_1 , PriceUnitAdj , visitedNum , firstVisitTime , visitedNum15 , visitedNum30 , PriceDealMean_1 , PriceDealMax_1 , SumDeal_1 , PriceDealMean , PriceDealMax , SumDeal , PriceListedMin , PriceCase1_ToAI_Pst , PriceCase2_ToAI_Pst , PriceCase1_ToLst_Pst , PriceCase2_ToLst_Pst , PriceCase1 , PriceCase1AdjPst , SumCase1 , PriceCase2 , PriceCase2AdjPst , SumCase2 , VOPPBT , VOPPB , bindCommunityId , bindCommunityPst , bindBlockClass , bindBlockClassPst , bindBlockPropertyLevel , bindBlockPropertyLevelPst , bindBlockProjectType , bindBlockProjectTypePst , bindCountyProjectType , bindCountyProjectTypePst , VOPPAT , VOPPA
from @table;
end;
</update>
<insert id="insert" parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice">
insert into dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth}
(
ProjectID
, ProjectName
, ProjectAddr
, County
, Block
, "Loop"
, IsIndxGen
, IsPstCalc
, StatusRun
, ProjectSPLabel
, PropertyType
, ProjectType
, ProjectTypeDtl
, ProjectLevel
, Year
, MainArea
, AreaCoff
, YearCoff
, PriceNote
, BasePriceDft
, MainPriceDft
, BasePrice_1
, PriceUnitAdj
, Visited_Num
, First_Visit_Time
, Visited_Num_15
, Visited_Num_30
, PriceDealMean_1
, PriceDealMax_1
, SumDeal_1
, PriceDealMean
, PriceDealMax
, SumDeal
, PriceListedMin
, PriceCase1_ToAI_Pst
, PriceCase2_ToAI_Pst
, PriceCase1_ToLst_Pst
, PriceCase2_ToLst_Pst
, PriceCase1
, PriceCase1AdjPst
, SumCase1
, PriceCase2
, PriceCase2AdjPst
, SumCase2
, VOPPBT
, VOPPB
, BindProjID
, Bind_Proj_Pst
, Bind_Block_Class
, Bind_Block_Class_Pst
, Bind_Block_Plevel
, Bind_Block_Plevel_Pst
, Bind_Block_PType
, Bind_Block_Ptype_Pst
, Bind_County_PType
, Bind_County_Ptype_Pst
, VOPPAT
, VOPPA
)
values(
#{communityId}
, #{communityName}
, #{communityAddress}
, #{countyName}
, #{blockName}
, #{loopName}
, #{hasIndex}
, #{isPstCalc}
, #{status}
, #{label}
, #{propertyType}
, #{projectType}
, #{projectTypeDtl}
, #{propertyLevel}
, #{year}
, #{area}
, #{areaCoefficient}
, #{yearCoefficient}
, #{comment}
, #{basePriceDraft}
, #{mainPriceDraft}
, #{basePrice_1}
, #{priceUnitAdj}
, #{visitedNum}
, #{firstVisitTime,jdbcType=DATE}
, #{visitedNum15}
, #{visitedNum30}
, #{priceDealMean_1}
, #{priceDealMax_1}
, #{sumDeal_1}
, #{priceDealMean}
, #{priceDealMax}
, #{sumDeal}
, #{priceListedMin}
, #{priceCase1_ToAI_Pst}
, #{priceCase2_ToAI_Pst}
, #{priceCase1_ToLst_Pst}
, #{priceCase2_ToLst_Pst}
, #{priceCase1}
, #{priceCase1AdjPst}
, #{sumCase1}
, #{priceCase2}
, #{priceCase2AdjPst}
, #{sumCase2}
, #{voppbt}
, #{voppb}
, #{bindCommunityId}
, #{bindCommunityPst}
, #{bindBlockClass}
, #{bindBlockClassPst}
, #{bindBlockPropertyLevel}
, #{bindBlockPropertyLevelPst}
, #{bindBlockProjectType}
, #{bindBlockProjectTypePst}
, #{bindCountyProjectType}
, #{bindCountyProjectTypePst}
, #{voppat}
, #{voppa}
)
</insert>
<!-- 同步到基价库 -->
<insert id="insertUVBasePrice" parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice">
insert into obpm_LianCheng_Data.dbo.TLK_基价信息
(
LASTMODIFIED
, FORMNAME
, AUTHOR
, AUTHOR_DEPT_INDEX
, CREATED
, FORMID
, ISTMP
, VERSIONS
, APPLICATIONID
, STATEINT
, LASTMODIFIER
, DOMAINID
, AUDITORLIST
, COAUDITORLIST
, ID
, ITEM_PriceID
, ITEM_AIRAID
, ITEM_PROJECTTYPE
, ITEM_PRICETYPE
, ITEM_STANDARDPRICE
, ITEM_MAINAREAPRICE
, ITEM_VALUEPOINT
, ITEM_PRICEEXPLAIN
, ITEM_UPDATEPERSON
, ITEM_UPDATEDATE
, ITEM_PRICECHG
)
values(
getdate()
, N'数据维护管理/小区基价'
, N'amQRUkvYQAsAec1JGLp'
, 'Os6qe4Pmq5viTO8lTnW'
, getdate()
, N'ybte0OakLV17UzAyoVU'
, 0
, 1
, N'Ts7TykYmuEzzZgWhXHj'
, 0
, N'amQRUkvYQAsAec1JGLp'
, N'BclzHtmfLQoAA5ICTb5'
, N'{}'
, N'{}'
, newid()
, newid()
, #{communityId}
, 1
, 1
, #{basePriceDraft}
, #{mainPriceDraft}
, #{valuePoint}
, #{comment}
, '自动生成'
, getadte()
, #{voppa}
)
</insert>
<insert id="insertUVDocument" parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice">
insert into obpm_LianCheng_Data.dbo.T_DOCUMENT
(
ID
, LASTMODIFIED
, FORMNAME
, AUTHOR
, AUTHOR_DEPT_INDEX
, CREATED
, FORMID
, ISTMP
, VERSIONS
, APPLICATIONID
, LASTMODIFIER
, DOMAINID
, AUDITORLIST
, COAUDITORLIST
, MAPPINGID
)
SELECT ID
, LASTMODIFIED
, FORMNAME
, AUTHOR
, AUTHOR_DEPT_INDEX
, CREATED
, FORMID
, ISTMP
, VERSIONS
, APPLICATIONID
, LASTMODIFIER
, DOMAINID
, AUDITORLIST
, COAUDITORLIST
, ID
FROM obpm_LianCheng_Data.dbo.TLK_基价信息
where id=#{priceId}
</insert>
<update id="updateLastMonthPrice">
update b
set b.ITEM_STANDARDPRICE = a.BasePrice_1
, b.ITEM_MAINAREAPRICE = a.BasePrice_1 * isnull(c.AreaCoff, 1) * isnull(c.AreaCoff, 1) * isnull(c.YearCoff,1)
from DWA_PROJECTBASEPRICE_MANU_${yearMonth} a
join obpm_LianCheng_Data.dbo.TLK_基价信息 b
on a.ProjectID = b.ITEM_AIRAID
join dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth} c
on a.ProjectID = c.ProjectID
where isnull(a.BasePrice_1, 1) <![CDATA[ <> ]]> isnull(b.ITEM_STANDARDPRICE, 1)
and b.ITEM_VALUEPOINT = #{lastValuePoint} and a.ProjectId=#{communityId};
</update>
</mapper>

View File

@ -0,0 +1,186 @@
<?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.price.mapper.ComputeResidenceSalePriceMapper">
<resultMap type="com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice"
id="MainMappingResult">
<result property="id" column="sid"/>
<result property="communityId" column="ProjectID"/>
<result property="communityName" column="ProjectName"/>
<result property="communityAddress" column="ProjectAddr"/>
<result property="countyName" column="county"/>
<result property="blockName" column="block"/>
<result property="loopName" column="loop"/>
<result property="hasIndex" column="isIndxGen"/>
<result property="isPstCalc" column="isPstCalc"/>
<result property="status" column="statusRun"/>
<result property="label" column="ProjectSPLabel"/>
<result property="propertyType" column="propertyType"/>
<result property="projectType" column="projectType"/>
<result property="projectTypeDtl" column="projectTypeDtl"/>
<result property="propertyLevel" column="projectLevel"/>
<result property="year" column="year"/>
<result property="area" column="mainArea"/>
<result property="yearCoefficient" column="yearCoff"/>
<result property="areaCoefficient" column="areaCoff"/>
<result property="comment" column="priceNote"/>
<result property="basePriceDraft" column="basePriceDft"/>
<result property="mainPriceDraft" column="mainPriceDft"/>
<result property="basePrice_1" column="basePrice_1"/>
<result property="voppat" column="voppat"/>
<result property="voppa" column="voppa"/>
<!-- 案例均价 -->
<result property="priceUnitAdj" column="PriceUnitAdj"/>
<result property="visitedNum" column="Visited_Num"/>
<result property="firstVisitTime" column="First_Visit_Time"/>
<result property="visitedNum15" column="Visited_Num_15"/>
<result property="visitedNum30" column="Visited_Num_30"/>
<!-- 上周期 -->
<result property="priceDealMean_1" column="priceDealMean_1"/>
<result property="priceDealMax_1" column="priceDealMax_1"/>
<result property="sumDeal_1" column="sumDeal_1"/>
<!-- 本周期 -->
<result property="priceDealMean" column="priceDealMean"/>
<result property="priceDealMax" column="priceDealMax"/>
<result property="sumDeal" column="sumDeal"/>
<!-- 挂牌最低价 -->
<result property="priceListedMin" column="priceListedMin"/>
<result property="priceCase1_ToAI_Pst" column="priceCase1_ToAI_Pst"/>
<result property="priceCase2_ToAI_Pst" column="priceCase2_ToAI_Pst"/>
<result property="priceCase1_ToLst_Pst" column="priceCase1_ToLst_Pst"/>
<result property="priceCase2_ToLst_Pst" column="priceCase2_ToLst_Pst"/>
<result property="priceCase1" column="priceCase1"/>
<result property="priceCase1AdjPst" column="priceCase1AdjPst"/>
<result property="sumCase1" column="sumCase1"/>
<result property="priceCase2" column="priceCase2"/>
<result property="priceCase2AdjPst" column="priceCase2AdjPst"/>
<result property="sumCase2" column="sumCase2"/>
<result property="voppbt" column="voppbt"/>
<result property="voppb" column="voppb"/>
<!-- 绑定小区相关信息 -->
<result property="bindCommunityId" column="bindProjID"/>
<result property="bindCommunityPst" column="bind_Proj_Pst"/>
<result property="bindBlockClass" column="bind_Block_Class"/>
<result property="bindBlockClassPst" column="bind_Block_Class_Pst"/>
<result property="bindBlockPropertyLevel" column="bind_Block_Plevel"/>
<result property="bindBlockPropertyLevelPst" column="bind_Block_Plevel_Pst"/>
<result property="bindBlockProjectType" column="bind_Block_PType"/>
<result property="bindBlockProjectTypePst" column="bind_Block_Ptype_Pst"/>
<result property="bindCountyProjectType" column="bind_County_PType"/>
<result property="bindCountyProjectTypePst" column="bind_County_Ptype_Pst"/>
</resultMap>
<sql id="selectAllField">
SELECT SID
,ProjectID
,ProjectName
,ProjectAddr
,County
,Block
,"Loop"
,IsIndxGen
,IsPstCalc
,StatusRun
,ProjectSPLabel
,PropertyType
,ProjectType
,ProjectTypeDtl
,ProjectLevel
,Year
,MainArea
,AreaCoff
,YearCoff
,PriceNote
,BasePriceDft
,MainPriceDft
,BasePrice_1
,PriceUnitAdj
,Visited_Num
,First_Visit_Time
,Visited_Num_15
,Visited_Num_30
,PriceDealMean_1
,PriceDealMax_1
,SumDeal_1
,PriceDealMean
,PriceDealMax
,SumDeal
,PriceListedMin
,PriceCase1_ToAI_Pst
,PriceCase2_ToAI_Pst
,PriceCase1_ToLst_Pst
,PriceCase2_ToLst_Pst
,PriceCase1
,PriceCase1AdjPst
,SumCase1
,PriceCase2
,PriceCase2AdjPst
,SumCase2
,VOPPBT
,VOPPB
,BindProjID
,Bind_Proj_Pst
,Bind_Block_Class
,Bind_Block_Class_Pst
,Bind_Block_Plevel
,Bind_Block_Plevel_Pst
,Bind_Block_PType
,Bind_Block_Ptype_Pst
,Bind_County_PType
,Bind_County_Ptype_Pst
,VOPPAT
,VOPPA
FROM dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth}
</sql>
<!-- 分页总数 -->
<select id="selectPageCount"
parameterType="com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice" resultType="int">
select count(1) from dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth}
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
</if>
<if test="nameOrAddress != null">
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%', #{nameOrAddress}, '%'))
</if>
</where>
</select>
<!-- 分页列表 -->
<select id="selectPageList"
parameterType="com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice"
resultMap="MainMappingResult">
<include refid="selectAllField"/>
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
</if>
<if test="nameOrAddress != null">
AND (ProjectName like concat('%', #{nameOrAddress}, '%') or ProjectAddr like concat('%', #{nameOrAddress}, '%'))
</if>
</where>
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
</select>
<!-- -->
<select id="selectComputeResidenceRentBasePriceById" parameterType="String" resultMap="MainMappingResult">
<include refid="selectAllField"/>
where id = #{id}
</select>
<!-- 获取表名 -->
<select id="yearMonthList" resultType="com.ruoyi.project.common.VueSelectModel">
SELECT right(name,6) as value, right(name,6) as label
FROM sys.tables
where name like 'DWA_PROJECTBASEPRICE_IMDT_%'
order by cast(right(name,6) as int) desc
</select>
<!-- <update id="updateComputeResidenceRentBasePrice" parameterType="com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice">-->
<!-- update TLK_计价办公核准基价 set ITEM_YEARMONTH=ITEM_YEARMONTH-->
<!-- <trim prefix="SET" suffixOverrides=",">-->
<!-- </trim>-->
<!-- where id = #{id}-->
<!-- </update>-->
</mapper>

View File

@ -163,6 +163,145 @@
, AdjustedCumNum int
, PriceTotalIn decimal(18, 2)
, PriceDateIn date
, CaseType int
, RangeFlag int
);
</update>
<update id="createComputePriceTable">
<bind name="targetTableName" value="'dbo.DWA_PROJECTBASEPRICE_IMDT_' + yearMonth" />
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
create table ${targetTableName}
(
SID int not null identity(1,1)
, ProjectID nvarchar(20) primary key
, ProjectName nvarchar(1024)
, ProjectAddr nvarchar(1024)
, County nvarchar(512)
, Block nvarchar(512)
, Loop nvarchar(512)
, IsIndxGen tinyint
, IsPstCalc tinyint
, StatusRun tinyint
, ProjectSPLabel nvarchar(64)
, PropertyType nvarchar(256)
, ProjectType nvarchar(256)
, ProjectTypeDtl nvarchar(256)
, ProjectLevel nvarchar(64)
, Year int
, MainArea decimal(18, 2)
, AreaCoff decimal(7, 4)
, YearCoff decimal(7, 4)
, PriceNote nvarchar(1024)
, BasePriceDft decimal(18, 2)
, MainPriceDft decimal(18, 2)
, BasePrice_1 decimal(18, 2)
, PriceUnitAdj decimal(18, 2)
, Visited_Num int
, First_Visit_Time date
, Visited_Num_15 int
, Visited_Num_30 int
, PriceDealMean_1 decimal(18, 2)
, PriceDealMax_1 decimal(18, 2)
, SumDeal_1 int
, PriceDealMean decimal(18, 2)
, PriceDealMax decimal(18, 2)
, SumDeal int
, PriceListedMin decimal(18, 2)
, PriceCase1_ToAI_Pst decimal(18, 6)
, PriceCase2_ToAI_Pst decimal(18, 6)
, PriceCase1_ToLst_Pst decimal(18, 6)
, PriceCase2_ToLst_Pst decimal(18, 6)
, PriceCase1 decimal(18, 2)
, PriceCase1AdjPst decimal(18, 6)
, SumCase1 int
, PriceCase2 decimal(18, 2)
, PriceCase2AdjPst decimal(18, 6)
, SumCase2 int
, VOPPBT varchar(64)
, VOPPB decimal(18, 6)
, BindProjID int
, Bind_Proj_Pst decimal(18, 6)
, Bind_Block_Class nvarchar(128)
, Bind_Block_Class_Pst decimal(18, 6)
, Bind_Block_Plevel nvarchar(128)
, Bind_Block_Plevel_Pst decimal(18, 6)
, Bind_Block_PType nvarchar(128)
, Bind_Block_Ptype_Pst decimal(18, 6)
, Bind_County_PType nvarchar(128)
, Bind_County_Ptype_Pst decimal(18, 6)
, VOPPAT varchar(64)
, VOPPA decimal(18, 6)
);
</update>
<!-- 人工修正价格表和作价表一摸一样 -->
<update id="createArtificialPriceTable">
<bind name="targetTableName" value="'dbo.DWA_PROJECTBASEPRICE_MANU_' + yearMonth" />
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
create table ${targetTableName}
(
SID int not null identity(1,1)
, ProjectID nvarchar(20) primary key
, ProjectName nvarchar(1024)
, ProjectAddr nvarchar(1024)
, County nvarchar(512)
, Block nvarchar(512)
, Loop nvarchar(512)
, IsIndxGen tinyint
, IsPstCalc tinyint
, StatusRun tinyint
, ProjectSPLabel nvarchar(64)
, PropertyType nvarchar(256)
, ProjectType nvarchar(256)
, ProjectTypeDtl nvarchar(256)
, ProjectLevel nvarchar(64)
, Year int
, MainArea decimal(18, 2)
, AreaCoff decimal(7, 4)
, YearCoff decimal(7, 4)
, PriceNote nvarchar(1024)
, BasePriceDft decimal(18, 2)
, MainPriceDft decimal(18, 2)
, BasePrice_1 decimal(18, 2)
, PriceUnitAdj decimal(18, 2)
, Visited_Num int
, First_Visit_Time date
, Visited_Num_15 int
, Visited_Num_30 int
, PriceDealMean_1 decimal(18, 2)
, PriceDealMax_1 decimal(18, 2)
, SumDeal_1 int
, PriceDealMean decimal(18, 2)
, PriceDealMax decimal(18, 2)
, SumDeal int
, PriceListedMin decimal(18, 2)
, PriceCase1_ToAI_Pst decimal(18, 6)
, PriceCase2_ToAI_Pst decimal(18, 6)
, PriceCase1_ToLst_Pst decimal(18, 6)
, PriceCase2_ToLst_Pst decimal(18, 6)
, PriceCase1 decimal(18, 2)
, PriceCase1AdjPst decimal(18, 6)
, SumCase1 int
, PriceCase2 decimal(18, 2)
, PriceCase2AdjPst decimal(18, 6)
, SumCase2 int
, VOPPBT varchar(64)
, VOPPB decimal(18, 6)
, BindProjID int
, Bind_Proj_Pst decimal(18, 6)
, Bind_Block_Class nvarchar(128)
, Bind_Block_Class_Pst decimal(18, 6)
, Bind_Block_Plevel nvarchar(128)
, Bind_Block_Plevel_Pst decimal(18, 6)
, Bind_Block_PType nvarchar(128)
, Bind_Block_Ptype_Pst decimal(18, 6)
, Bind_County_PType nvarchar(128)
, Bind_County_Ptype_Pst decimal(18, 6)
, VOPPAT varchar(64)
, VOPPA decimal(18, 6)
);
</update>
</mapper>

View File

@ -0,0 +1,581 @@
/******************************小区案例整合中间表***********************************/
insert into dbo.DW_HOUSINGCASE_COMM_#yearMonth#
(
case_id
, HouseholdsID_LJ
, ProjectID_LJ
, ProjectID
, ProjectName
, ProjectAddr
, County
, Block
, Loop
, Roomtype
, Area
, Towards
, UpperFloorSum
, UpperFloorNum
, Elevator
, Decoration
, Year
, AreaCoff
, TowardsCoff
, FloorCoff
, DecorationRng
, YearCoff
, BuildingCoff
, BasePrice_1
, PriceTotal
, PriceUnit
, PriceUnitAdj
, Visited_Num
, First_Visit_Time
, Visited_Num_15
, Visited_Num_30
, Status
, AdjustedValue
, AdjustedPst
, AdjustedCumValue
, AdjustedCumPst
, AdjustedCumValueAbs
, AdjustedCumPstAbs
, AdjustedCumNum
, PriceTotalIn
, PriceDateIn
)
select a.case_id
, a.HouseholdsID_LJ
, a.ProjectID_LJ
, c.ITEM_AIRAID
, c.ITEM_RANAME
, c.ITEM_RAADRESS
, c.ITEM_DISTRICT1
, c.ITEM_SECTOR121
, c.ITEM_CIRCLEPOSITION
, a.Roomtype
, a.Area
, a.Towards
, a.UpperFloorSum
, a.UpperFloorNum
, a.Elevator
, a.Decoration
, a.Year
, isnull(a.AreaCoff, 1)
, isnull(a.TowardsCoff, 1)
, isnull(a.FloorCoff, 1)
, isnull(a.DecorationRng, 0)
, isnull(a.YearCoff, 1)
, isnull(a.BuildingCoff, 1)
, d.ITEM_STANDARDPRICE as BasePrice_1
, a.PriceTotal
, a.PriceUnit
, a.PriceUnitAdj
, a.Visited_Num
, a.First_Visit_Time
, a.Visited_Num_15
, a.Visited_Num_30
, a.Status
, a.AdjustedValue
, a.AdjustedPst
, a.AdjustedCumValue
, a.AdjustedCumPst
, a.AdjustedCumValueAbs
, a.AdjustedCumPstAbs
, a.AdjustedCumNum
, a.PriceTotalIn
, a.PriceDateIn
from dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth# a
left join obpm_LianCheng_Data.dbo.TLK_链家小区 b
on a.ProjectID_LJ = b.ITEM_ProjectID_LJ
left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 c
on b.ITEM_ProjectID = c.ITEM_AIRAID
and c.ITEM_PROJECTTYPE = '1'
left join obpm_LianCheng_Data.dbo.TLK_基价信息 d
on b.ITEM_ProjectID = d.ITEM_AIRAID
and d.ITEM_PRICETYPE = '1'
and d.ITEM_PROJECTTYPE='1'
and d.ITEM_VALUEPOINT = '#valuePoint#'
where a.Status not in ( 4, 5 );
insert into dbo.DW_HOUSINGCASE_COMM_#yearMonth#
(
case_id
, ProjectID
, ProjectName
, ProjectAddr
, County
, Block
, Loop
, Area
, UpperFloorSum
, UpperFloorNum
, AreaCoff
, TowardsCoff
, FloorCoff
, DecorationRng
, YearCoff
, BuildingCoff
, BasePrice_1
, PriceTotal
, PriceUnit
, PriceUnitAdj
, Status
, PriceDateIn
)
select a.case_id
, a.ProjectID
, c.ITEM_RANAME
, c.ITEM_RAADRESS
, c.ITEM_DISTRICT1
, c.ITEM_SECTOR121
, c.ITEM_CIRCLEPOSITION
, a.Area
, a.UpperFloorSum
, a.UpperFloorNum
, isnull(a.AreaCoff, 1)
, 1
, isnull(a.FloorCoff, 1)
, 0
, 1
, isnull(a.BuildingCoff, 1)
, d.ITEM_STANDARDPRICE as BasePrice_1
, a.PriceTotal
, a.PriceUnit
, a.PriceUnitAdj
, NULL
, a.DateContract
from dbo.ODS_HOUSINGCASE_DEAL_#yearMonth# a
left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 c
on a.ProjectID = c.ITEM_AIRAID
and c.ITEM_PROJECTTYPE = '1'
left join obpm_LianCheng_Data.dbo.TLK_基价信息 d
on a.ProjectID = d.ITEM_AIRAID
and d.ITEM_PRICETYPE = '1'
and d.ITEM_PROJECTTYPE='1'
and d.ITEM_VALUEPOINT = '#valuePoint#';
---HouseholdsID_LJ0NULLRangeFlag类型需要修改
update DW_HOUSINGCASE_COMM_#yearMonth#
set CaseType = case when HouseholdsID_LJ is null then 0 else 1 end,
RangeFlag = case when BasePrice_1 is null then 19
when HouseholdsID_LJ is null and abs(PriceUnitAdj*1.0/BasePrice_1-1)<=0.1 then 10
when HouseholdsID_LJ is not null and abs(PriceUnitAdj*1.0/BasePrice_1-1)<=0.06 then 10
when abs(PriceUnitAdj*1.0/BasePrice_1-1)>0.5 then 17
else 16 end;
/******************************小区基价计算中间表***********************************/
----
create table #DWA_PROJECTBASEPRICE_IMDT_STEP_1
(
ProjectID bigint primary key
, ProjectName nvarchar(1024)
, ProjectAddr nvarchar(1024)
, County nvarchar(512)
, Block nvarchar(512)
, Loop nvarchar(512)
, IsIndxGen tinyint
, IsPstCalc tinyint
, StatusRun tinyint
, BasePrice_1 decimal(18, 2)
, PriceUnitAdj decimal(18, 2)
, Visited_Num int
, First_Visit_Time date
, Visited_Num_15 int
, Visited_Num_30 int
, PriceDealMean_1 decimal(18, 2)
, PriceDealMax_1 decimal(18, 2)
, SumDeal_1 int
, PriceDealMean decimal(18, 2)
, PriceDealMax decimal(18, 2)
, SumDeal int
, PriceListedMin decimal(18, 2)
, PriceCase1_ToAI_Pst decimal(18, 6)
, PriceCase2_ToAI_Pst decimal(18, 6)
, PriceCase1_ToLst_Pst decimal(18, 6)
, PriceCase2_ToLst_Pst decimal(18, 6)
, PriceCase1 decimal(18, 2)
, PriceCase1AdjPst decimal(18, 6)
, SumCase1 int
, PriceCase2 decimal(18, 2)
, PriceCase2AdjPst decimal(18, 6)
, SumCase2 int
, PriceCase2_ToAI_0 decimal(18, 6) --PriceCase2_ToAI_Pst非空的案例数量
, PriceCase2_ToLst_0 decimal(18, 6) --PriceCase2_ToLst_Pst非空的案例数量
, PriceCase2Adj_0 decimal(18, 6) --PriceCase2AdjPst非空的案例数量
);
SELECT ITEM_DICTYPE,ITEM_DICVALUE,ITEM_DICTEXT
into #DICT
from obpm_LianCheng_Data.dbo.TLK_字典数据信息
where ITEM_DICTYPE in ('板块','环线','物业类型','物业档次','区域','小区类型')
update #DICT set ITEM_DICTEXT='浦东新区' where ITEM_DICVALUE='2' and ITEM_DICTYPE='区域';
update #DICT set ITEM_DICTEXT='静安区' where ITEM_DICVALUE='18' and ITEM_DICTYPE='区域';
update #DICT set ITEM_DICTEXT='黄浦区' where ITEM_DICVALUE='8' and ITEM_DICTYPE='区域';
---12status in (1,2)
insert into #DWA_PROJECTBASEPRICE_IMDT_STEP_1
select
a.ITEM_AIRAID,
a.ITEM_RANAME,
a.ITEM_RAADRESS,
g.ITEM_DICTEXT,
e.ITEM_DICTEXT,
f.ITEM_DICTEXT,
a.ITEM_ISBUILDINDEX,
a.ITEM_GAINCALCULATION,
a.ITEM_RUNNINGSTATE,
d.ITEM_STANDARDPRICE,
b.PriceUnitAdj,
b.Visited_Num,
b.First_Visit_Time,
b.Visited_Num_15,
b.Visited_Num_30,
c.PriceDealMean_1,
c.PriceDealMax_1,
c.SumDeal_1,
b.PriceDealMean,
b.PriceDealMax,
b.SumDeal,
b.PriceListedMin,
b.PriceCase1_ToAI_Pst,
b.PriceCase2_ToAI_Pst,
(PriceCase1 - PriceCase1_1)*1.0/PriceCase1_1 as PriceCase1_ToLst_Pst,
(PriceCase2 - PriceCase2_1)*1.0/PriceCase2_1 as PriceCase2_ToLst_Pst,
b.PriceCase1, b.PriceCase1AdjPst, b.SumCase1, b.PriceCase2, b.PriceCase2AdjPst, b.SumCase2,
b.PriceCase2_ToAI_0,
case when b.PriceCase2_ToAI_0<>0 and c.PriceCase2_1 is not null then PriceCase2_ToAI_0
else 0 end as PriceCase2_ToLst_0,
b.PriceCase2Adj_0
from obpm_LianCheng_Data.dbo.TLK_小区信息管理 a
left join (
select ProjectID, avg(BasePrice_1) as BasePrice_1, avg(PriceUnitAdj) as PriceUnitAdj, avg(Visited_Num) as Visited_Num,
min(First_Visit_Time) as First_Visit_Time, avg(Visited_Num_15) Visited_Num_15, avg(Visited_Num_30) as Visited_Num_30,
avg(case when CaseType=0 then PriceUnitAdj end) as PriceDealMean,
max(case when CaseType=0 then PriceUnitAdj end) as PriceDealMax,
count(case when CaseType=0 then 1 end) as SumDeal,
min(case when CaseType=1 then PriceUnitAdj end) as PriceListedMin,
avg(case when RangeFlag<>19 then PriceUnitAdj end) as PriceCase1,
count(case when RangeFlag<>19 then 1 end) as SumCase1,
avg(case when RangeFlag<>19 then PriceUnitAdj end)*1.0/avg(BasePrice_1)-1 as PriceCase1_ToAI_Pst,
avg(case when RangeFlag<>19 and status in (1,2) then AdjustedPst end) as PriceCase1AdjPst,
avg(case when RangeFlag = 10 then PriceUnitAdj end) as PriceCase2,
count(case when RangeFlag = 10 then 1 end) as SumCase2,
avg(case when RangeFlag = 10 then PriceUnitAdj end)*1.0/avg(BasePrice_1)-1 as PriceCase2_ToAI_Pst,
avg(case when RangeFlag = 10 and status in (1,2) then AdjustedPst end) as PriceCase2AdjPst,
count(case when RangeFlag = 10 then 1 end) as PriceCase2_ToAI_0,
count(case when RangeFlag = 10 and status in (1,2) then 1 end) as PriceCase2Adj_0
from dbo.DW_HOUSINGCASE_COMM_#yearMonth# group by ProjectID
) b on a.ITEM_AIRAID = b.ProjectID
left join (
select ProjectID, avg(case when CaseType=0 then PriceUnitAdj end) as PriceDealMean_1,
max(case when CaseType=0 then PriceUnitAdj end) as PriceDealMax_1,
count(case when CaseType=0 then 1 end) as SumDeal_1,
avg(case when RangeFlag<>19 then PriceUnitAdj end) as PriceCase1_1,
avg(case when RangeFlag = 10 then PriceUnitAdj end) as PriceCase2_1
from dbo.DW_HOUSINGCASE_COMM_#lastYearMonth#
group by ProjectID
) c on a.ITEM_AIRAID = c.ProjectID
left join obpm_LianCheng_Data.dbo.TLK_基价信息 d on a.ITEM_AIRAID = d.ITEM_AIRAID and d.ITEM_PROJECTTYPE='1' and d.ITEM_PRICETYPE='1'
left JOIN #DICT e on A.ITEM_SECTOR121=E.ITEM_DICVALUE and E.ITEM_DICTYPE='板块'
left JOIN #DICT f on A.ITEM_CIRCLEPOSITION=f.ITEM_DICVALUE and f.ITEM_DICTYPE='环线'
left JOIN #DICT g on A.ITEM_DISTRICT1=g.ITEM_DICVALUE and g.ITEM_DICTYPE='区域'
where a.ITEM_PROJECTTYPE='1' and d.ITEM_VALUEPOINT='#valuePoint#';
----
create table #DWA_PROJECTBASEPRICE_IMDT_STEP_2
(
ProjectID bigint primary key
, VOPPBT int ---
, VOPPB decimal(18, 6)---
);
INSERT INTO #DWA_PROJECTBASEPRICE_IMDT_STEP_2
SELECT a.ProjectID,
CASE WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 11
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 12
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 13
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 14
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 15
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 16
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 17
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 18
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN 19
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 21
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 22
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 23
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 24
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0
AND (PriceCase2_ToAI_0<>0 OR PriceCase2_ToLst_0<>0 OR PriceCase2Adj_0<>0)) THEN 25
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 26
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 27
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 28
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN 29
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 0
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 32
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 33
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 34
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 35
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 36
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 37
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 38
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN 39
END AS VOPPBT,
CASE WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN MIN --11
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN MDN*1.0/4 --12
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN MDN*1.0/4 --13
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN MDN*1.0/4 --14
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 0 --15
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 0 --16
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN MDN*1.0/4 --17
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 0 --18
WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN MDN --19
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN MDN*1.0/4 --21
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN MDN*1.0/4 --22
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 0 --23
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 0 --24
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0
AND (PriceCase2_ToAI_0<>0 OR PriceCase2_ToLst_0<>0 OR PriceCase2Adj_0<>0)) THEN 0 --25
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN MIN*1.0/3 --26
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 0 --27
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 0 --28
WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN MDN --29
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 0 --31
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 0 --32
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN MDN --33
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 0 --34
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 0 --35
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN MDN --36
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN MDN --37
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN MDN --38
WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN MDN --39
END AS VOPPB
FROM (SELECT projectid, ISNULL(PriceCase2_ToAI_Pst,0) PriceCase2_ToAI_Pst,
ISNULL(PriceCase2_ToLst_Pst,0) PriceCase2_ToLst_Pst, ISNULL(PriceCase2AdjPst,0) PriceCase2AdjPst,
PriceCase2_ToAI_0, PriceCase2_ToLst_0, PriceCase2Adj_0
FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_1 where PriceUnitAdj is not null) a
LEFT JOIN (
select projectid, min(vl) as MIN, avg(MDN) as MDN
from (
select projectid, tp, vl, PERCENTILE_CONT(0.5) within group(order by vl)over(partition by projectid) as MDN --
from (
select projectid, PriceCase2_ToAI_Pst, PriceCase2_ToLst_Pst, PriceCase2AdjPst
from #DWA_PROJECTBASEPRICE_IMDT_STEP_1 where PriceUnitAdj is not null
) as t unpivot(vl for tp in (PriceCase2_ToAI_Pst, PriceCase2_ToLst_Pst, PriceCase2AdjPst)) as up
)tt group by projectid
)b ON a.projectid = b.projectid;
----
-----2019.11.12沿
create table #DWA_PROJECTBASEPRICE_IMDT_STEP_3
(
ProjectID bigint primary key
, BindProjID int
, Bind_Proj_Pst decimal(18, 6)
, Bind_Block_Class nvarchar(128)
, Bind_Block_Class_Pst decimal(18, 6)
, Bind_Block_Plevel nvarchar(128)
, Bind_Block_Plevel_Pst decimal(18, 6)
, Bind_Block_PType nvarchar(128)
, Bind_Block_PType_Pst decimal(18, 6)
, Bind_County_PType nvarchar(128)
, Bind_County_PType_Pst decimal(18, 6)
, Bind_Price_1_PType nvarchar(128)
, Bind_Price_1_PType_Pst decimal(18, 6)
, VOPPAT varchar(64)
, VOPPA decimal(18, 6)
);
-- 1.绑定ID (注意:对于上期基价为空的小区,不参与涨跌幅推导)
SELECT
A.ITEM_AIRAID as ProjectId,
e.ITEM_DICTEXT as Block,
g.ITEM_DICTEXT as County,
h.ITEM_DICTEXT as PROPERTYLEVEL,
A.ITEM_ProjectTypeDtl as PROJECTTYPEDTL,
A.ITEM_BindClassID as BINDCLASSID,
B.ProjectID AS BindProjID,
B.VOPPB AS Bind_Proj_Pst,
CASE
when C.ProjectID IS NOT NULL THEN C.VOPPBT
WHEN B.ProjectID IS NOT NULL AND D.ITEM_STANDARDPRICE IS NOT NULL THEN '8505' END AS VOPPAT,
CASE
when C.ProjectID IS NOT NULL THEN C.VOPPB
WHEN B.ProjectID IS NOT NULL AND D.ITEM_STANDARDPRICE IS NOT NULL THEN B.VOPPB END AS VOPPA,
D.ITEM_STANDARDPRICE as BasePrice
INTO #TempBindProjID
FROM obpm_LianCheng_Data.dbo.TLK_小区信息管理 A
LEFT JOIN (SELECT ProjectID, VOPPBT, VOPPB FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_2 WHERE ABS(VOPPB) < 0.1) B
on a.item_BindProjID = B.ProjectID
LEFT JOIN (SELECT ProjectID, VOPPBT, VOPPB FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_2 WHERE ABS(VOPPB) < 0.1) C
on A.item_airaid = C.ProjectID
left join obpm_LianCheng_Data.dbo.TLK_基价信息 d
on a.ITEM_AIRAID = d.ITEM_AIRAID
and d.ITEM_PRICETYPE = '1'
and d.ITEM_PROJECTTYPE = '1'
and a.ITEM_PROJECTTYPE=d.ITEM_PROJECTTYPE
left join #DICT e on e.ITEM_DICTYPE='板块' and e.ITEM_DICVALUE=a.ITEM_SECTOR121
left JOIN #DICT g on g.ITEM_DICTYPE='区域' and A.ITEM_DISTRICT1=g.ITEM_DICVALUE
left JOIN #DICT h on h.ITEM_DICTYPE='物业档次' and A.ITEM_PROPERTYLEVEL=h.ITEM_DICVALUE
where a.ITEM_PROJECTTYPE='1' and d.ITEM_VALUEPOINT = '#valuePoint#'
-- 判断小区是否有效
-- 2.板块+绑定
SELECT A.ProjectId, A.Block, A.County, A.PROPERTYLEVEL, A.PROJECTTYPEDTL, A.BINDCLASSID, A.BindProjID, A.Bind_Proj_Pst,
B.Bind_Block_Class, B.Bind_Block_Class_Pst,
CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT
WHEN B.Bind_Block_Class IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8501' END AS VOPPAT,
CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA
WHEN B.Bind_Block_Class IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_Block_Class_Pst END AS VOPPA,
A.BasePrice
INTO #Temp_Bind_Block_Class
FROM #TempBindProjID A
LEFT JOIN (
SELECT Block+BindClassID AS Bind_Block_Class, AVG(VOPPA) AS Bind_Block_Class_Pst
FROM #TempBindProjID GROUP BY Block+BindClassID
) B
ON A.Block +A.BindClassID = B.Bind_Block_Class AND B.Bind_Block_Class_Pst IS NOT NULL
-- 3.板块+物业档次
SELECT A.ProjectID, A.Block, A.County, A.PROPERTYLEVEL, A.ProjectTypeDtl, A.BindClassID, A.BindProjID, A.Bind_Proj_Pst,
A.Bind_Block_Class, A.Bind_Block_Class_Pst, B.Bind_Block_Plevel, B.Bind_Block_Plevel_Pst,
CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT
WHEN B.Bind_Block_Plevel IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8502' END AS VOPPAT,
CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA
WHEN B.Bind_Block_Plevel IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_Block_Plevel_Pst END AS VOPPA,
A.BasePrice
INTO #Temp_Bind_Block_Plevel
FROM #Temp_Bind_Block_Class A
LEFT JOIN (
SELECT Block+PROPERTYLEVEL AS Bind_Block_Plevel, AVG(VOPPA) AS Bind_Block_Plevel_Pst
FROM #Temp_Bind_Block_Class GROUP BY Block+PROPERTYLEVEL
) B
ON A.Block +A.PROPERTYLEVEL = B.Bind_Block_Plevel AND B.Bind_Block_Plevel_Pst IS NOT NULL
-- 4.板块+物业类型
SELECT A.ProjectID, A.Block, A.County, A.PROPERTYLEVEL, A.ProjectTypeDtl, A.BindClassID, A.BindProjID, A.Bind_Proj_Pst,
A.Bind_Block_Class, A.Bind_Block_Class_Pst, A.Bind_Block_Plevel, A.Bind_Block_Plevel_Pst,
B.Bind_Block_PType, B.Bind_Block_PType_Pst,
CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT
WHEN B.Bind_Block_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8503' END AS VOPPAT,
CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA
WHEN B.Bind_Block_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_Block_PType_Pst END AS VOPPA,
A.BasePrice
INTO #Temp_Bind_Block_PType
FROM #Temp_Bind_Block_Plevel A
LEFT JOIN (
SELECT Block+ProjectTypeDtl AS Bind_Block_PType, AVG(VOPPA) AS Bind_Block_PType_Pst
FROM #Temp_Bind_Block_Plevel GROUP BY Block+ProjectTypeDtl
) B
ON A.Block+A.ProjectTypeDtl = B.Bind_Block_PType AND B.Bind_Block_PType_Pst IS NOT NULL
-- 5.区域+物业类型
SELECT A.ProjectID, A.Block, A.County, A.PROPERTYLEVEL, A.ProjectTypeDtl, A.BindClassID, A.BindProjID, A.Bind_Proj_Pst,
A.Bind_Block_Class, A.Bind_Block_Class_Pst, A.Bind_Block_Plevel, A.Bind_Block_Plevel_Pst,
A.Bind_Block_PType, A.Bind_Block_PType_Pst, B.Bind_County_PType, B.Bind_County_PType_Pst,
CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT
WHEN B.Bind_County_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8504' END AS VOPPAT,
CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA
WHEN B.Bind_County_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_County_PType_Pst END AS VOPPA,
A.BasePrice
INTO #Temp_Bind_County_PType
FROM #Temp_Bind_Block_PType A
LEFT JOIN (
SELECT County+ProjectTypeDtl AS Bind_County_PType, AVG(VOPPA) AS Bind_County_PType_Pst
FROM #Temp_Bind_Block_PType GROUP BY County+ProjectTypeDtl
) B
ON A.County +A.ProjectTypeDtl = B.Bind_County_PType AND B.Bind_County_PType_Pst IS NOT NULL
-- (11-39 ; 8505 ID平均值; 8506ID; 8501+; 8502+; 8503+; 8504+)
--6. 沿
INSERT INTO #DWA_PROJECTBASEPRICE_IMDT_STEP_3
SELECT ProjectID, BindProjID, Bind_Proj_Pst,
Bind_Block_Class, Bind_Block_Class_Pst, Bind_Block_Plevel, Bind_Block_Plevel_Pst,
Bind_Block_PType, Bind_Block_PType_Pst, Bind_County_PType, Bind_County_PType_Pst,
'沿用上周期基价' as Bind_Price_1_PType, 0 as Bind_Price_1_PType_Pst,
CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT
WHEN A.BasePrice IS NOT NULL THEN '9999' END AS VOPPAT,
CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA
WHEN A.BasePrice IS NOT NULL THEN 0 END AS VOPPA
FROM #Temp_Bind_County_PType A
DROP TABLE #TempBindProjID
DROP TABLE #Temp_Bind_Block_Class
DROP TABLE #Temp_Bind_Block_Plevel
DROP TABLE #Temp_Bind_Block_PType
DROP TABLE #Temp_Bind_County_PType
----
create table #DWA_PROJECTBASEPRICE_IMDT_STEP_4
(
ProjectID bigint primary key
, ProjectSPLabel nvarchar(64)
, PropertyType nvarchar(256)
, ProjectType nvarchar(256)
, ProjectTypeDtl nvarchar(256)
, ProjectLevel nvarchar(64)
, Year int
, MainArea decimal(18, 2)
, AreaCoff decimal(7, 4)
, YearCoff decimal(7, 4)
, PriceNote nvarchar(1024)
);
INSERT INTO #DWA_PROJECTBASEPRICE_IMDT_STEP_4
select A.ITEM_AIRAID
, A.ITEM_RALABLE
, e.ITEM_DICTEXT
, g.ITEM_DICTEXT
, A.ITEM_PROJECTTYPEDTL
, h.ITEM_DICTEXT
, A.ITEM_MAINCOMPLETIONYEAR
, A.ITEM_MAINAREA
, A.ITEM_AREACOFF
, A.ITEM_YEARCOFF
, D.ITEM_PRICEEXPLAIN
from obpm_LianCheng_Data.dbo.TLK_小区信息管理 A
left join obpm_LianCheng_Data.dbo.TLK_基价信息 D
on A.ITEM_AIRAID = D.ITEM_AIRAID
and A.ITEM_PROJECTTYPE = D.ITEM_PROJECTTYPE
and a.ITEM_PROJECTTYPE=d.ITEM_PROJECTTYPE
and D.ITEM_VALUEPOINT = '#valuePoint#'
left join #DICT e on e.ITEM_DICTYPE='物业类型' and e.ITEM_DICVALUE=a.ITEM_RAPROPERTYTYPE
left JOIN #DICT g on g.ITEM_DICTYPE='小区类型' and A.ITEM_RATYPE=g.ITEM_DICVALUE
left JOIN #DICT h on h.ITEM_DICTYPE='物业档次' and A.ITEM_PROPERTYLEVEL=h.ITEM_DICVALUE
where A.ITEM_PROJECTTYPE = '1'
and D.ITEM_PROJECTTYPE = '1'
and D.ITEM_PRICETYPE = '1';
----
INSERT INTO DWA_PROJECTBASEPRICE_IMDT_#yearMonth#
SELECT A.ProjectID, A.ProjectName, A.ProjectAddr, A.County, A.Block, A.Loop, a.IsIndxGen, a.IsPstCalc, a.StatusRun, D.ProjectSPLabel, D.PropertyType, D.ProjectType,
D.ProjectTypeDtl, D.ProjectLevel, D.[Year], D.MainArea, ISNULL(D.AreaCoff,1), ISNULL(D.YearCoff,1), D.PriceNote,
A.BasePrice_1*(1+C.VOPPA) AS BasePriceDft,
A.BasePrice_1*(1+C.VOPPA)*ISNULL(D.AreaCoff,1)*ISNULL(D.YearCoff,1) AS MainPriceDft,
A.BasePrice_1, A.PriceUnitAdj, A.Visited_Num, A.First_Visit_Time, A.Visited_Num_15, A.Visited_Num_30,
A.PriceDealMean_1, A.PriceDealMax_1, A.SumDeal_1, A.PriceDealMean, A.PriceDealMax, A.SumDeal,
A.PriceListedMin, A.PriceCase1_ToAI_Pst, A.PriceCase2_ToAI_Pst, A.PriceCase1_ToLst_Pst, A.PriceCase2_ToLst_Pst,
A.PriceCase1, A.PriceCase1AdjPst, A.SumCase1, A.PriceCase2, A.PriceCase2AdjPst, A.SumCase2, B.VOPPBT, B.VOPPB,
C.BindProjID, C.Bind_Proj_Pst, C.Bind_Block_Class, C.Bind_Block_Class_Pst, C.Bind_Block_Plevel, C.Bind_Block_Plevel_Pst,
C.Bind_Block_PType, C.Bind_Block_PType_Pst, C.Bind_County_PType, C.Bind_County_PType_Pst, C.VOPPAT, C.VOPPA
FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_1 A
LEFT JOIN #DWA_PROJECTBASEPRICE_IMDT_STEP_2 B
ON A.ProjectID = B.ProjectID
LEFT JOIN #DWA_PROJECTBASEPRICE_IMDT_STEP_3 C
ON A.ProjectID = C.ProjectID
LEFT JOIN #DWA_PROJECTBASEPRICE_IMDT_STEP_4 D
ON A.ProjectID = D.ProjectID;
drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_1;
drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_2;
drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_3;
drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_4;
drop table #DICT;

View File

@ -0,0 +1,62 @@
create type DWA_PROJECTBASEPRICE_MANU_Table as table
(
communityId nvarchar(20) null ,
communityName nvarchar(200) null ,
communityAddress nvarchar(1024) null ,
countyName nvarchar(200) null ,
blockName nvarchar(200) null ,
loopName nvarchar(200) null ,
hasIndex int null ,
isPstCalc int null ,
status int null ,
label nvarchar(200) null ,
propertyType nvarchar(200) null ,
projectType nvarchar(200) null ,
projectTypeDtl nvarchar(200) null ,
propertyLevel nvarchar(200) null ,
year int null ,
area decimal(18, 2) null ,
areaCoefficient decimal(7, 4) null ,
yearCoefficient decimal(7, 4) null ,
comment nvarchar(1024) null ,
basePriceDraft decimal(18, 2) null ,
mainPriceDraft decimal(18, 2) null ,
basePrice_1 decimal(18, 2) null ,
voppat nvarchar(200) null ,
voppa decimal(18, 2) null ,
priceUnitAdj decimal(18, 2) null ,
visitedNum int null ,
firstVisitTime date null ,
visitedNum15 int null ,
visitedNum30 int null ,
priceDealMean_1 decimal(18, 2) null ,
priceDealMax_1 decimal(18, 2) null ,
sumDeal_1 int null ,
priceDealMean decimal(18, 2) null ,
priceDealMax decimal(18, 2) null ,
sumDeal int null ,
priceListedMin decimal(18, 2) null ,
priceCase1_ToAI_Pst decimal(18, 6) null ,
priceCase2_ToAI_Pst decimal(18, 6) null ,
priceCase1_ToLst_Pst decimal(18, 6) null ,
priceCase2_ToLst_Pst decimal(18, 6) null ,
priceCase1 decimal(18, 2) null ,
priceCase1AdjPst decimal(18, 6) null ,
sumCase1 int null ,
priceCase2 decimal(18, 2) null ,
priceCase2AdjPst decimal(18, 6) null ,
sumCase2 int null ,
voppbt nvarchar(200) null ,
voppb decimal(18, 6) null ,
bindCommunityId int null ,
bindCommunityPst decimal(18, 6) null ,
bindBlockClass nvarchar(200) null ,
bindBlockClassPst decimal(18, 6) null ,
bindBlockPropertyLevel nvarchar(200) null ,
bindBlockPropertyLevelPst decimal(18, 6) null ,
bindBlockProjectType nvarchar(200) null ,
bindBlockProjectTypePst decimal(18, 6) null ,
bindCountyProjectType nvarchar(200) null ,
bindCountyProjectTypePst decimal(18, 6) null
)

View File

@ -0,0 +1,71 @@
package com.uvaluation;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import org.junit.Test;
import java.math.BigDecimal;
import java.util.Date;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class GenerateTableTests {
@Test
public void getELTableColumn() {
Class<?> targetClass = ComputeResidenceSaleBasePrice.class;
Stream.of(targetClass.getDeclaredFields()).forEach(x -> {
if (x.isAnnotationPresent(com.ruoyi.framework.aspectj.lang.annotation.Excel.class)) {
com.ruoyi.framework.aspectj.lang.annotation.Excel excel =
x.getAnnotation(com.ruoyi.framework.aspectj.lang.annotation.Excel.class);
System.out.println(String.format("<el-table-column label=\"%s\" align=\"center\" " +
"prop=\"%s\" />", excel.name(), x.getName()));
}
});
}
@Test
public void generateUserTableType() {
Class<?> targetClass = ComputeResidenceSaleBasePrice.class;
Stream.of(targetClass.getDeclaredFields()).forEach(x -> {
if (x.isAnnotationPresent(com.ruoyi.framework.aspectj.lang.annotation.Excel.class)) {
if ("java.lang.String".equals(x.getType().getName()))
System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
".NVARCHAR);", x.getName()));
else if ("java.lang.Integer".equals(x.getType().getName()))
System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
".INT);", x.getName()));
else if ("java.math.BigDecimal".equals(x.getType().getName()))
System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
".DECIMAL);", x.getName()));
else if ("java.util.Date".equals(x.getType().getName()))
System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
".DATE);", x.getName()));
}
});
}
@Test
public void generateUserTableScript() {
Class<?> targetClass = ComputeResidenceSaleBasePrice.class;
Stream.of(targetClass.getDeclaredFields()).forEach(x -> {
if (x.isAnnotationPresent(com.ruoyi.framework.aspectj.lang.annotation.Excel.class)) {
System.out.println(x.getName() + ",");
// System.out.println(x.getName() + " nvarchar(200) null ,");
// if ("java.lang.String".equals(x.getType().getName()))
// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
// ".NVARCHAR);", x.getName()));
// else if ("java.lang.Integer".equals(x.getType().getName()))
// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
// ".INT);", x.getName()));
// else if ("java.math.BigDecimal".equals(x.getType().getName()))
// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
// ".DECIMAL);", x.getName()));
// else if ("java.util.Date".equals(x.getType().getName()))
// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" +
// ".DATE);", x.getName()));
}
});
}
}

View File

@ -3,11 +3,18 @@ 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 com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService;
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;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RuoYiApplication.class)
@ -16,6 +23,8 @@ public class ResidenceSaleBasePriceTests {
@Autowired
private IOriginalResidenceSaleOpeningCaseService originalResidenceOpeningCaseService;
@Autowired
private IArtificialResidenceSalePriceService artificialResidenceSalePriceService;
@Autowired
private IOriginalResidenceSaleClosingCaseService originalResidenceClosingCaseService;
@Test
@ -28,5 +37,14 @@ public class ResidenceSaleBasePriceTests {
originalResidenceClosingCaseService.pullData();
}
@Test
public void testBatchImport() {
List<ComputeResidenceSaleBasePrice> list = new LinkedList<>();
ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice = new ComputeResidenceSaleBasePrice();
computeResidenceSaleBasePrice.setCommunityId("10101");
computeResidenceSaleBasePrice.setBasePriceDraft(new BigDecimal(12222));
list.add(computeResidenceSaleBasePrice);
artificialResidenceSalePriceService.batchImport(202007, list);
}
}