feature (住宅销售基价作价): 完成住宅销售基价作价迁移

1. 住宅销售成交案例下载
2. 住宅销售成交案例清洗
3. 住宅销售挂牌案例下载
4. 住宅销售挂牌案例清洗
5. 初步价格计算
6. 人工修改导入、导出
7. 同步到基价库
8. 基价信息和挂牌案例推送到CALC
This commit is contained in:
purple 2020-07-02 16:14:24 +08:00
parent d2a91d9b31
commit 0ace1f040f
30 changed files with 1606 additions and 527 deletions

View File

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

View File

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

View File

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

View File

@ -2,7 +2,11 @@
<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-select
v-model="queryParams.yearMonth"
placeholder="请选择年月"
@change="yearMonthChange(queryParams.yearMonth)"
>
<el-option
v-for="item in yearMonthList"
:value="item.value"
@ -36,7 +40,7 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
@ -45,7 +49,7 @@
@click="handleUpdate"
v-hasPermi="['system:user:edit']"
>修改</el-button>
</el-col>
</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
@ -62,15 +66,15 @@
size="mini"
@click="handleImport"
v-hasPermi="['system:user:import']"
>导入</el-button>
>文件导入</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 type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="年月" align="center" prop="yearMonth" /> -->
<el-table-column label="小区ID" align="center" prop="communityId" fixed />
<el-table-column label="小区名称" align="center" width="200" prop="communityName" fixed />
<el-table-column label="小区地址" align="center" prop="communityAddress" />
<el-table-column label="区域" align="center" prop="countyName" />
@ -89,7 +93,12 @@
prop="isPstCalc"
:formatter="yesOrNotFormatter"
/>
<el-table-column label="运行状态" align="center" prop="status" />
<el-table-column
label="运行状态"
align="center"
prop="status"
:formatter="runningStateFormatter"
/>
<el-table-column label="特殊小区标签" align="center" prop="label" />
<el-table-column label="物业类型" align="center" prop="propertyType" />
<el-table-column label="小区类型" align="center" prop="projectType" />
@ -139,7 +148,7 @@
<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">
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@ -156,7 +165,7 @@
v-hasPermi="['system:user:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table-column>-->
</el-table>
<pagination
@ -265,7 +274,7 @@ export default {
//
url:
process.env.VUE_APP_BASE_API +
"/data/price/residence/sale/artificial/importData/"
"/data/sale-price/residence/artificial/importData/"
},
//
form: {},
@ -285,6 +294,10 @@ export default {
});
},
methods: {
yearMonthChange: function(yearMonth) {
// this.upload.url += "/" + yearMonth;
// console.log(this.upload.url);
},
yesOrNotFormatter: function(row, column, cellValue, index) {
if (cellValue) return "是";
return "否";
@ -293,6 +306,15 @@ export default {
if (cellValue) return "正常";
return "失效";
},
runningStateFormatter: function(row, column, cellValue, index) {
if (1 === cellValue) return "正常状态";
else if (2 === cellValue) return "建设中";
else if (3 === cellValue) return "建设中";
else if (4 === cellValue) return "已撤销";
else if (5 === cellValue) return "合并";
else if (8 === cellValue) return "分拆";
return "未知状态";
},
dateFormatter: function(row, column, cellValue, index) {
if (cellValue) {
return cellValue.substring(0, 10);

View File

@ -0,0 +1,244 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :rules="rules" :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 label="状态">
<el-select v-model="queryParams.status" clearable>
<el-option label="正常" value="1"></el-option>
<el-option label="失效" value="0"></el-option>
</el-select>
</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 label="年月" align="center" prop="yearMonth" />
<el-table-column label="小区ID" align="center" prop="communityId" />
<el-table-column label="标准基价" align="center" prop="basePrice" />
<el-table-column label="主力面积基价" align="center" prop="mainPrice" />
<el-table-column label="主力面积系数" align="center" prop="areaCoefficient" />
<el-table-column label="竣工年份系数" align="center" prop="yearCoefficient" />
<el-table-column label="涨跌幅" align="center" prop="voppa" />
<el-table-column label="涨跌幅类型" align="center" prop="voppat" />
<el-table-column label="价值时点" align="center" prop="priceDate" :formatter="dateFormatter" />
<el-table-column label="价格说明" align="center" prop="comment" />
<el-table-column label="更新日期" align="center" prop="updateDate" :formatter="dateFormatter" />
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormatter" />
<el-table-column label="变化字段" align="center" prop="adjustPriceComment" />
</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,
export2File,
getYearMonthList
} from "@/api/data/ultimateResidenceSalePrice";
export default {
name: "ultimateResidenceSalePrice",
data() {
//
var yearMonthValidator = (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,
status: 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/rentprice/residence/ultimate/importData"
},
//
form: {},
//
rules: {
yearMonth: [
{ validator: yearMonthValidator, trigger: "blur" },
{ validator: yearMonthValidator, trigger: "change" }
]
}
};
},
created() {
this.loading = false;
getYearMonthList().then(response => {
this.yearMonthList = response.data;
});
},
methods: {
yesOrNotFormatter: function(row, column, cellValue, index) {
if (cellValue) return "是";
return "否";
},
dateFormatter:function(row, column, cellValue, index){
if(cellValue) return cellValue.substring(0,10);
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;
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有住宅销售基价数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return export2File(queryParams);
})
.then(response => {
this.download(response.msg);
})
.catch(function() {});
}
}
};
</script>

61
ruoyi/sql/sale_price.sql Normal file
View File

@ -0,0 +1,61 @@
create type [dbo].[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
)
go

View File

@ -33,8 +33,10 @@ public interface OriginalResidenceRentOpeningCaseMapper {
* @return
*/
int createAssembleTable(@Param("yearMonth") Integer yearMonth);
/**
* 作价表
*
* @param yearMonth
* @return
*/
@ -42,11 +44,20 @@ public interface OriginalResidenceRentOpeningCaseMapper {
/**
* 人工修正价格表
*
* @param yearMonth
* @return
*/
int createArtificialPriceTable(@Param("yearMonth") Integer yearMonth);
/**
* 结果表
*
* @param yearMonth
* @return
*/
int createUltimatePriceTable(@Param("yearMonth") Integer yearMonth);
/**
* 分页总数
*

View File

@ -56,6 +56,14 @@ public interface OriginalResidenceSaleOpeningCaseMapper {
*/
int createArtificialPriceTable(@Param("yearMonth") Integer yearMonth);
/**
* 结果表
*
* @param yearMonth
* @return
*/
int createUltimatePriceTable(@Param("yearMonth") Integer yearMonth);
/**
* 分页总数
*

View File

@ -87,6 +87,7 @@ public class OriginalResidenceRentOpeningCaseServiceImpl implements IOriginalRes
originalResidenceRentOpeningCaseMapper.createAssembleTable(computeTableRoute);
originalResidenceRentOpeningCaseMapper.createComputePriceTable(computeTableRoute);
originalResidenceRentOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
originalResidenceRentOpeningCaseMapper.createUltimatePriceTable(computeTableRoute);
syncOriginalResidenceRentOpeningCaseMapper.createTable(syncTableRoute);
}

View File

@ -49,6 +49,9 @@ public class OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalRes
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
// targetTableRoute = 202005;
// computeTableRoute = 202007;
prepare(computeTableRoute);
List<OriginalResidenceSaleClosingCase> list =
downloadOriginalResidenceSaleClosingCaseMapper.download(targetTableRoute);

View File

@ -56,8 +56,8 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
calendar.add(Calendar.MONTH, 1);
Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
computeTableRoute = 202007;
lastYearMonth = 202006;
// computeTableRoute = 202007;
// lastYearMonth = 202006;
prepare(computeTableRoute, syncTableRoute);
List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download();
@ -82,7 +82,7 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes
originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
originalResidenceSaleOpeningCaseMapper.createUltimatePriceTable(computeTableRoute);
// syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
}

View File

@ -17,10 +17,11 @@ 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.domain.UltimateResidenceSaleBasePrice;
import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IComputeResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IUltimateResidenceRentBasePriceService;
import com.ruoyi.project.data.price.service.IUltimateResidenceSalePriceService;
import com.ruoyi.project.system.domain.UploadFile;
import com.ruoyi.project.system.service.IUploadFileService;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,18 +29,19 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.LinkedList;
import java.util.List;
@RestController
@RequestMapping("/data/price/residence/sale")
@RequestMapping("/data/sale-price/residence")
public class ResidenceSaleBasePriceController extends BaseController {
@Autowired
private IOriginalResidenceSalePriceService computeResidenceSalePriceService;
private IComputeResidenceSalePriceService computeResidenceSalePriceService;
@Autowired
private IArtificialResidenceSalePriceService artificialResidenceSalePriceService;
@Autowired
private IUltimateResidenceRentBasePriceService ultimateResidenceRentBasePriceService;
private IUltimateResidenceSalePriceService ultimateResidenceSalePriceService;
@Autowired
private IUploadFileService fileService;
@Autowired
@ -85,8 +87,11 @@ public class ResidenceSaleBasePriceController extends BaseController {
int total = computeResidenceSalePriceService.selectCount(computeResidenceSaleBasePrice);
computeResidenceSaleBasePrice.setPageIndex(0);
computeResidenceSaleBasePrice.setPageSize(total);
List<ComputeResidenceSaleBasePrice> list =
computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice);
List<ComputeResidenceSaleBasePrice> list = null;
if (0 == total)
list = new LinkedList<>();
else
list = computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice);
ExcelUtil<ComputeResidenceSaleBasePrice> util = new ExcelUtil<>(ComputeResidenceSaleBasePrice.class);
return util.exportExcel(list, "住宅销售基价" + computeResidenceSaleBasePrice.getYearMonth());
}
@ -192,76 +197,53 @@ public class ResidenceSaleBasePriceController extends BaseController {
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));
// }
//
/**
* 查询 住宅租赁基价列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/ultimate/list")
public TableDataInfo ultimateList(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice) {
int pageIndex = ServletUtils.getParameterToInt("pageIndex");
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
ultimateResidenceSaleBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
ultimateResidenceSaleBasePrice.setPageSize(pageSize);
int total = ultimateResidenceSalePriceService.selectCount(ultimateResidenceSaleBasePrice);
List<UltimateResidenceSaleBasePrice> list =
ultimateResidenceSalePriceService.selectList(ultimateResidenceSaleBasePrice);
list.forEach(x -> x.setYearMonth(ultimateResidenceSaleBasePrice.getYearMonth()));
return getDataTable(list, total);
}
/**
* 查询 年月
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/ultimate/yearmonth")
public AjaxResult ultimateYearMonthList() {
List<VueSelectModel> list = ultimateResidenceSalePriceService.getYearMonth();
return AjaxResult.success(list);
}
/**
* 导出 住宅销售基价列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "住宅销售基价", businessType = BusinessType.EXPORT)
@GetMapping("/ultimate/export")
public AjaxResult ultimateExport(UltimateResidenceSaleBasePrice
ultimateResidenceSaleBasePrice) {
int total = ultimateResidenceSalePriceService.selectCount(ultimateResidenceSaleBasePrice);
ultimateResidenceSaleBasePrice.setPageIndex(0);
ultimateResidenceSaleBasePrice.setPageSize(total);
List<UltimateResidenceSaleBasePrice> list = null;
if (0 == total)
list = new LinkedList<>();
else
list = ultimateResidenceSalePriceService.selectList(ultimateResidenceSaleBasePrice);
ExcelUtil<UltimateResidenceSaleBasePrice> util = new ExcelUtil<>(UltimateResidenceSaleBasePrice.class);
return util.exportExcel(list, "住宅销售基价" + ultimateResidenceSaleBasePrice.getYearMonth());
}
}

View File

@ -4,13 +4,11 @@ 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 UltimateResidenceSaleBasePrice extends BaseEntity {
@ -21,31 +19,48 @@ public class UltimateResidenceSaleBasePrice extends BaseEntity {
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 BigDecimal basePrice;
@Excel(name = "主力面积基价")
private BigDecimal mainPrice;
@Excel(name = "主力面积系数")
private BigDecimal areaCoefficient;
@Excel(name = "竣工年份系数")
private BigDecimal yearCoefficient;
@Excel(name = "涨跌幅")
private BigDecimal voppa;
@Excel(name = "涨跌幅类型")
private String voppat;
@Excel(name = "价值时点")
private Date priceDate;
@Excel(name = "价格说明")
private String comment;
@Excel(name = "更新日期")
private Date updateDate;
@Excel(name = "状态")
private Boolean status;
@Excel(name = "是否标准楼栋")
private Boolean isStandardBuilding;
@Excel(name = "更改价格说明")
private String 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 String getId() {
return id;
}
@ -62,14 +77,6 @@ public class UltimateResidenceSaleBasePrice extends BaseEntity {
this.yearMonth = yearMonth;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getCommunityId() {
return communityId;
}
@ -78,52 +85,68 @@ public class UltimateResidenceSaleBasePrice extends BaseEntity {
this.communityId = communityId;
}
public String getMainPrice() {
public BigDecimal getBasePrice() {
return basePrice;
}
public void setBasePrice(BigDecimal basePrice) {
this.basePrice = basePrice;
}
public BigDecimal getMainPrice() {
return mainPrice;
}
public void setMainPrice(String mainPrice) {
public void setMainPrice(BigDecimal mainPrice) {
this.mainPrice = mainPrice;
}
public String getMainPriceRent() {
return mainPriceRent;
public BigDecimal getAreaCoefficient() {
return areaCoefficient;
}
public void setMainPriceRent(String mainPriceRent) {
this.mainPriceRent = mainPriceRent;
public void setAreaCoefficient(BigDecimal areaCoefficient) {
this.areaCoefficient = areaCoefficient;
}
public String getMainPricePst() {
return mainPricePst;
public BigDecimal getYearCoefficient() {
return yearCoefficient;
}
public void setMainPricePst(String mainPricePst) {
this.mainPricePst = mainPricePst;
public void setYearCoefficient(BigDecimal yearCoefficient) {
this.yearCoefficient = yearCoefficient;
}
public String getMainPriceRentPst() {
return mainPriceRentPst;
public BigDecimal getVoppa() {
return voppa;
}
public void setMainPriceRentPst(String mainPriceRentPst) {
this.mainPriceRentPst = mainPriceRentPst;
public void setVoppa(BigDecimal voppa) {
this.voppa = voppa;
}
public String getMainPriceType() {
return mainPriceType;
public String getVoppat() {
return voppat;
}
public void setMainPriceType(String mainPriceType) {
this.mainPriceType = mainPriceType;
public void setVoppat(String voppat) {
this.voppat = voppat;
}
public String getMainPriceRentType() {
return mainPriceRentType;
public Date getPriceDate() {
return priceDate;
}
public void setMainPriceRentType(String mainPriceRentType) {
this.mainPriceRentType = mainPriceRentType;
public void setPriceDate(Date priceDate) {
this.priceDate = priceDate;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Date getUpdateDate() {
@ -142,14 +165,6 @@ public class UltimateResidenceSaleBasePrice extends BaseEntity {
this.status = status;
}
public Boolean getStandardBuilding() {
return isStandardBuilding;
}
public void setStandardBuilding(Boolean standardBuilding) {
isStandardBuilding = standardBuilding;
}
public String getAdjustPriceComment() {
return adjustPriceComment;
}
@ -157,20 +172,4 @@ public class UltimateResidenceSaleBasePrice extends BaseEntity {
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;
}
}

View File

@ -48,6 +48,13 @@ public interface ArtificialResidenceSaleBasePriceMapper {
*/
int updateLastMonthPrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 初始化执行环境
*
* @return
*/
int initImport();
/**
* 创建用于批量导入的存储过程
*
@ -56,6 +63,7 @@ public interface ArtificialResidenceSaleBasePriceMapper {
*/
int prepareBachImport(@Param("yearMonth") Integer yearMonth);
/**
* 分页列表
*

View File

@ -0,0 +1,34 @@
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 com.ruoyi.project.data.price.domain.UltimateResidenceSaleBasePrice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("compute")
public interface UltimateResidenceSalePriceMapper {
/**
* 分页列表
*
* @param ultimateResidenceSaleBasePrice
* @return
*/
List<UltimateResidenceSaleBasePrice> selectPageList(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice);
/**
* 分页总数
*
* @param ultimateResidenceSaleBasePrice
* @return
*/
Integer selectPageCount(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice);
/**
* @return
*/
List<VueSelectModel> yearMonthList();
}

View File

@ -8,7 +8,7 @@ import java.util.List;
/**
* 计算住宅基价
*/
public interface IOriginalResidenceSalePriceService {
public interface IComputeResidenceSalePriceService {
/**
* 查询列表

View File

@ -0,0 +1,40 @@
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 com.ruoyi.project.data.price.domain.UltimateResidenceSaleBasePrice;
import java.util.List;
/**
* 住宅销售最终基价
*/
public interface IUltimateResidenceSalePriceService {
/**
* 分页列表
*
* @param ultimateResidenceSaleBasePrice
* @return 集合
*/
List<UltimateResidenceSaleBasePrice> selectList(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice);
/**
* 分页数量
*
* @param ultimateResidenceSaleBasePrice
* @return
*/
int selectCount(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice);
/**
* 获取表名
*
* @return
*/
List<VueSelectModel> getYearMonth();
}

View File

@ -1,43 +1,29 @@
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.common.utils.LoadUtil;
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.text.SimpleDateFormat;
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业务层处理
@ -94,9 +80,13 @@ public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResid
Calendar calendar = Calendar.getInstance();
calendar.set(yearMonth / 100, (yearMonth % 100) - 1, 1);
Date valuePoint = calendar.getTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
calendar.add(Calendar.MONTH, -1);
Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH) + 1));
Date lastValuePoint = calendar.getTime();
artificialResidenceSaleBasePriceMapper.initImport();
artificialResidenceSaleBasePriceMapper.prepareBachImport(yearMonth);
CopyOnWriteArrayList<ArtificialResidenceSaleBasePrice> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
list.parallelStream().forEach(inputModel -> {
@ -116,10 +106,11 @@ public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResid
// 声明变量
// 构造一个
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute";
String dbURL = "jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute_test";
String name = "sa";
String pwd = "Lcdatacenter_888";
Class.forName(driverName);
// jdbcTemplate.getDataSource().getConnection()
Connection conn = DriverManager.getConnection(dbURL, name, pwd);
SQLServerDataTable sourceDataTable = new SQLServerDataTable();
sourceDataTable.addColumnMetadata("communityId", java.sql.Types.NVARCHAR);
@ -251,8 +242,8 @@ public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResid
Statement statement = conn.createStatement();
try (CallableStatement cs = conn.prepareCall("{CALL dbo.BatchImportOfArtificialResidenceSale (?)}")) {
((SQLServerCallableStatement) cs).setStructured(1, "dbo.DWA_PROJECTBASEPRICE_MANU_Table",
try (CallableStatement cs = conn.prepareCall("{CALL BatchImportOfArtificialResidenceSale (?) }")) {
((SQLServerCallableStatement) cs).setStructured(1, "DWA_PROJECTBASEPRICE_MANU_Table",
sourceDataTable);
boolean resultSetReturned = cs.execute();
if (resultSetReturned) {
@ -263,8 +254,12 @@ public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResid
}
}
// 删除存储过程还原环境
statement.execute("drop procedure BatchImportOfArtificialResidenceSale");
statement.execute("IF OBJECT_ID('BatchImportOfArtificialResidenceSale', 'U') IS NOT NULL " +
" drop procedure BatchImportOfArtificialResidenceSale;");
conn.close();
after(yearMonth, lastYearMonth, valuePoint, lastValuePoint);
} catch (Exception e) {
e.printStackTrace();
}
@ -272,4 +267,20 @@ public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResid
StringBuilder successMsg = new StringBuilder("恭喜您,数据已全部导入成功!共 " + (successNum - failureNum) + "");
return successMsg.toString();
}
/**
* @param yearMonth
* @param lastYearMonth
*/
private void after(Integer yearMonth, Integer lastYearMonth, Date priceDate, Date lastPriceDate) {
String rawSql = LoadUtil.loadContent("sql-template/update_sale_price.sql");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String sql =
rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString())
.replace("#lastPriceDate#", simpleDateFormat.format(lastPriceDate))
.replace("#priceDate#", simpleDateFormat.format(priceDate));
jdbcTemplate.update(sql);
}
}

View File

@ -3,7 +3,7 @@ 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 com.ruoyi.project.data.price.service.IComputeResidenceSalePriceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,9 +18,9 @@ import java.util.List;
* @date 2020-05-20
*/
@Service
public class OriginalResidenceSalePriceServiceImpl implements IOriginalResidenceSalePriceService {
public class ComputeResidenceSalePriceServiceImpl implements IComputeResidenceSalePriceService {
private static final Logger log = LoggerFactory.getLogger(OriginalResidenceSalePriceServiceImpl.class);
private static final Logger log = LoggerFactory.getLogger(ComputeResidenceSalePriceServiceImpl.class);
@Autowired
private ComputeResidenceSalePriceMapper computeResidenceSalePriceMapper;

View File

@ -0,0 +1,64 @@
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.domain.UltimateResidenceSaleBasePrice;
import com.ruoyi.project.data.price.mapper.ComputeResidenceSalePriceMapper;
import com.ruoyi.project.data.price.mapper.UltimateResidenceSalePriceMapper;
import com.ruoyi.project.data.price.service.IComputeResidenceSalePriceService;
import com.ruoyi.project.data.price.service.IUltimateResidenceSalePriceService;
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 UltimateResidenceSalePriceServiceImpl implements IUltimateResidenceSalePriceService {
@Autowired
private UltimateResidenceSalePriceMapper ultimateResidenceSalePriceMapper;
@Override
public List<UltimateResidenceSaleBasePrice> selectList(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice) {
return ultimateResidenceSalePriceMapper.selectPageList(ultimateResidenceSaleBasePrice);
}
@Override
public int selectCount(UltimateResidenceSaleBasePrice ultimateResidenceSaleBasePrice) {
return ultimateResidenceSalePriceMapper.selectPageCount(ultimateResidenceSaleBasePrice);
}
@Override
public List<VueSelectModel> getYearMonth() {
return ultimateResidenceSalePriceMapper.yearMonthList();
}
// private static final Logger log = LoggerFactory.getLogger(UltimateResidenceSalePriceServiceImpl.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

@ -8,7 +8,7 @@ ruoyi:
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /var/log/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false

View File

@ -0,0 +1,150 @@
ruoyi:
# 名称
name: RuoYi
# 版本
version: 2.2.0
# 版权年份
copyrightYear: 2019
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# web服务器配置
server:
port: 9700
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# tomcat最大线程数默认为200
max-threads: 800
# Tomcat启动初始化的线程数默认值25
min-spare-threads: 30
spring:
datasource:
dynamic:
primary: master
hikari:
connection-timeout: 30000
validation-timeout: 30000
idle-timeout: 30000
max-lifetime: 30000
max-pool-size: 30
min-idle: 10
initialization-fail-timeout: 30000
connection-init-sql: select 1
connection-test-query: select 1
is-auto-commit: true
is-read-only: false
datasource:
master:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: LOLm2dI2UQF#RxOf
teemlink:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
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
username: sa
password: Lcdatacenter_888
clean:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
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
spider:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
username: purple
password: liancheng
# druid:
# statViewServlet:
# enabled: true
# # 设置白名单,不填则允许所有访问
# allow:
# url-pattern: /druid/*
# # 控制台管理用户名和密码
# login-username:
# login-password:
# dynamic:
# druid:
# # 初始连接数
# initialSize: 5
# # 最小连接池数量
# minIdle: 10
# # 最大连接池数量
# maxActive: 20
# # 配置获取连接等待超时的时间
# maxWait: 60000
# # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
# timeBetweenEvictionRunsMillis: 60000
# # 配置一个连接在池中最小生存的时间,单位是毫秒
# minEvictableIdleTimeMillis: 300000
# # 配置一个连接在池中最大生存的时间,单位是毫秒
# maxEvictableIdleTimeMillis: 900000
# # 配置检测连接是否有效
# validationQuery: SELECT 1
# testWhileIdle: true
# testOnBorrow: false
# testOnReturn: false
## webStatFilter:
## enabled: true
## filters: stat,wall
## wall:
## multiStatementAllow: true
# stat:
# log-slow-sql: true
# slow-sql-millis: 1000
# merge-sql: true
# primary: master
# datasource:
# # 主库数据源
# master:
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: LOLm2dI2UQF#RxOf
# # 从库数据源
## slave:
## # 从数据源开关/默认关闭
## enabled: false
## url:
## username:
## password:
# teemlink:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
# username: sa
# password: Lcdatacenter_888
# compute:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute
# username: sa
# password: Lcdatacenter_888
# clean:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean
# username: sa
# password: Lcdatacenter_888

View File

@ -8,7 +8,7 @@ ruoyi:
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /var/log/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false

View File

@ -49,7 +49,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:

View File

@ -183,6 +183,10 @@
PriceNote=#{comment}
where ProjectID=#{communityId};
</update>
<update id="initImport">
IF OBJECT_ID('BatchImportOfArtificialResidenceSale', 'P') IS NOT NULL
drop procedure BatchImportOfArtificialResidenceSale;
</update>
<update id="prepareBachImport" parameterType="int">
create procedure dbo.BatchImportOfArtificialResidenceSale @table DWA_PROJECTBASEPRICE_MANU_Table readonly
as

View File

@ -28,7 +28,7 @@
<result property="caseProvider" column="caseProvider"/>
</resultMap>
<select id="download" resultMap="resultMapping">
select top 100 llid
select llid
, lcid
, name
, type

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper">
<!--案例原始表-->
<update id="createOpeningCaseRawTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth +'_RAW'"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
@ -35,9 +35,7 @@
, CurlDate date
);
</update>
<!--过时-->
<update id="createTable">
<bind name="targetTableName" value="'dbo.original_residence_sale_opening_case_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
@ -101,7 +99,7 @@
create_time datetime NOT NULL
);
</update>
<!--清洗表-->
<update id="createCleanTable">
<bind name="targetTableName" value="'dbo.ODS_HOUSINGCASELISTED_LJ_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
@ -148,6 +146,7 @@
PriceDateOut date null
);
</update>
<!-- 案例汇总表 -->
<update id="createAssembleTable">
<bind name="targetTableName" value="'dbo.DW_HOUSINGCASE_COMM_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
@ -201,6 +200,7 @@
, RangeFlag int
);
</update>
<!-- 计算价格表 -->
<update id="createComputePriceTable">
<bind name="targetTableName" value="'dbo.DWA_PROJECTBASEPRICE_IMDT_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
@ -269,12 +269,12 @@
, 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)
@ -338,4 +338,28 @@
, VOPPA decimal(18, 6)
);
</update>
<!-- 最终价格表-->
<update id="createUltimatePriceTable">
<bind name="targetTableName" value="'dbo.ODS_PROJECT_PRICE_INFO_' + yearMonth"/>
IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL
drop table ${targetTableName};
create table ${targetTableName}
(
ID int primary key identity
, ProjectID bigint not null
, PriceType int
, BasePrice decimal(18, 2)
, MainPrice decimal(18, 2)
, AreaCoff decimal(7, 4)
, YearCoff decimal(7, 4)
, VOPPAT varchar(64)
, VOPPA decimal(18, 6)
, PriceDate date
, PriceNote nvarchar(1024)
, ModifyDate date
, Status bit
, AdjEvd nvarchar(64)
);
</update>
</mapper>

View File

@ -0,0 +1,80 @@
<?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.UltimateResidenceSalePriceMapper">
<resultMap type="com.ruoyi.project.data.price.domain.UltimateResidenceSaleBasePrice"
id="MainMappingResult">
<result property="id" column="id"/>
<result property="yearMonth" column="yearMonth"/>
<result property="communityId" column="ProjectID"/>
<!-- <result property="priceType" column="PriceType"/>-->
<result property="basePrice" column="BasePrice"/>
<result property="mainPrice" column="MainPrice"/>
<result property="areaCoefficient" column="AreaCoff"/>
<result property="yearCoefficient" column="YearCoff"/>
<result property="voppat" column="VOPPAT"/>
<result property="voppa" column="VOPPA"/>
<result property="priceDate" column="PriceDate"/>
<result property="comment" column="PriceNote"/>
<result property="updateDate" column="ModifyDate" jdbcType="DATE"/>
<result property="status" column="Status"/>
<result property="adjustPriceComment" column="AdjEvd"/>
</resultMap>
<sql id="selectAllField">
SELECT ID
,ProjectID
,PriceType
,BasePrice
,MainPrice
,AreaCoff
,YearCoff
,VOPPAT
,VOPPA
,PriceDate
,PriceNote
,ModifyDate
,Status
,AdjEvd
,${yearMonth} as yearMonth
FROM dbo.ODS_PROJECT_PRICE_INFO_${yearMonth}
</sql>
<!-- 分页总数 -->
<select id="selectPageCount"
parameterType="com.ruoyi.project.data.price.domain.UltimateResidenceSaleBasePrice" resultType="int">
select count(1) from dbo.ODS_PROJECT_PRICE_INFO_${yearMonth}
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
</if>
<if test="status != null">
AND Status = #{status}
</if>
</where>
</select>
<!-- 分页列表 -->
<select id="selectPageList"
parameterType="com.ruoyi.project.data.price.domain.UltimateResidenceSaleBasePrice"
resultMap="MainMappingResult">
<include refid="selectAllField"/>
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
</if>
<if test="status != null">
AND Status = #{status}
</if>
</where>
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
</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 'ODS_PROJECT_PRICE_INFO_%'
order by cast(right(name,6) as int) desc
</select>
</mapper>

View File

@ -1,5 +1,5 @@
truncate table dbo.DW_HOUSINGCASE_COMM_#yearMonth#;
truncate table dbo.DWA_PROJECTBASEPRICE_IMDT_#yearMonth#;
truncate table DW_HOUSINGCASE_COMM_#yearMonth#;
truncate table DWA_PROJECTBASEPRICE_IMDT_#yearMonth#;
insert into DW_HOUSINGCASE_COMM_#yearMonth#
select
@ -223,87 +223,163 @@ left join ODS_PROJECT_PRICE_INFO_#lastYearMonth# d on a.ITEM_AIRAID = d.ProjectI
where a.ITEM_ISBUILDINDEX='1' and a.ITEM_PROJECTTYPE='1' and d.Status=1;
----
update #DWA_PROJECTBASEPRICE_IMDT_STEP_1
set PriceCase1_ToAI_Pst=NULL
where PriceCase1_ToAI_Pst < -0.05 or PriceCase1_ToAI_Pst>=0.12;
update #DWA_PROJECTBASEPRICE_IMDT_STEP_1
set PriceCase2_ToAI_Pst=NULL
where PriceCase2_ToAI_Pst < -0.05 or PriceCase2_ToAI_Pst>=0.12;
update #DWA_PROJECTBASEPRICE_IMDT_STEP_1
set PriceCase1_ToLst_Pst=NULL
where PriceCase1_ToLst_Pst < -0.05 or PriceCase1_ToLst_Pst>=0.12;
update #DWA_PROJECTBASEPRICE_IMDT_STEP_1
set PriceCase2_ToLst_Pst=NULL
where PriceCase2_ToLst_Pst < -0.05 or PriceCase2_ToLst_Pst>=0.12;
-- 2. 对 #DWA_PROJECTBASEPRICE_IMDT_STEP_2 计算方式整体修改为如下。其它逻辑保存不变。
create table #DWA_PROJECTBASEPRICE_IMDT_STEP_2
(
ProjectID bigint primary key
, VOPPBT int ---
, VOPPBT varchar(64) ---
, VOPPB decimal(18, 6) ---
);
SELECT a.ProjectID, PriceCase1_ToAI_Pst, PriceCase2_ToAI_Pst, PriceCase1_ToLst_Pst, PriceCase2_ToLst_Pst,
case when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=4 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=4 then '4-4-0' --440=0
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=4 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=2 then '4-3-1'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=4 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=0 then '4-2-2'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=4 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=-2 then '4-1-3'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=4 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=-4 then '4-0-4'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=3 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=3 then '3-3-0'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=3 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=1 then '3-2-1'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=3 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=-1 then '3-1-2'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=3 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=-3 then '3-0-3'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=2 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=2 then '2-2-0'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=2 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=0 then '2-1-1'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=2 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=-2 then '2-0-2'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=1 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=1 then '1-1-0'
when abs(ToAI_1)+abs(ToAI_2)+abs(ToLst_1)+abs(ToLst_2)=1 and ToAI_1+ToAI_2+ToLst_1+ToLst_2=-1 then '1-0-1'
end as VOPPBT
INTO #TMP_STEP_2
FROM (SELECT projectid,
isnull(PriceCase1_ToAI_Pst,0) PriceCase1_ToAI_Pst, case when PriceCase1_ToAI_Pst>=0 then 1 when PriceCase1_ToAI_Pst<0 then -1 else 0 end as ToAI_1,
isnull(PriceCase2_ToAI_Pst,0) PriceCase2_ToAI_Pst, case when PriceCase2_ToAI_Pst>=0 then 1 when PriceCase2_ToAI_Pst<0 then -1 else 0 end as ToAI_2,
isnull(PriceCase1_ToLst_Pst,0) PriceCase1_ToLst_Pst, case when PriceCase1_ToLst_Pst>=0 then 1 when PriceCase1_ToLst_Pst<0 then -1 else 0 end as ToLst_1,
isnull(PriceCase2_ToLst_Pst,0) PriceCase2_ToLst_Pst, case when PriceCase2_ToLst_Pst>=0 then 1 when PriceCase2_ToLst_Pst<0 then -1 else 0 end as ToLst_2
FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_1 where PriceUnitAdj is not null
) a
select *
into #TMP_STEP_2_UP
from #TMP_STEP_2 t
unpivot (Vlu for Tp in (PriceCase1_ToAI_Pst, PriceCase2_ToAI_Pst, PriceCase1_ToLst_Pst, PriceCase2_ToLst_Pst)) UP
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
SELECT ProjectID, VOPPBT,
CASE WHEN VOPPBT in ('4-4-0', '4-0-4') THEN Vlu_4
WHEN VOPPBT in ('4-3-1', '3-3-0') THEN Vlu_3
WHEN VOPPBT in ('4-1-3', '3-0-3') THEN Vlu_3_
WHEN VOPPBT in ('2-2-0') THEN Vlu_2
WHEN VOPPBT in ('2-1-1') THEN Vlu_1
WHEN VOPPBT in ('4-2-2', '3-2-1') AND SM=2 THEN Mn
WHEN VOPPBT in ('4-2-2', '3-2-1') AND SM<2 THEN 0
WHEN VOPPBT in ('1-1-0') AND SM=1 THEN Mn
WHEN VOPPBT in ('1-1-0') AND SM<1 THEN 0
WHEN VOPPBT in ('3-1-2', '2-0-2', '1-0-1') THEN MX_
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;
FROM (
SELECT ProjectID, VOPPBT,
AVG(Vlu) as Vlu_4,
SUM(CASE WHEN Vlu>=0 THEN Vlu ELSE 0 END)/3 as Vlu_3, SUM(CASE WHEN Vlu<0 THEN Vlu ELSE 0 END)/3 as Vlu_3_,
SUM(CASE WHEN Vlu>=0 THEN Vlu ELSE 0 END)/2 as Vlu_2, SUM(CASE WHEN Vlu<0 THEN Vlu ELSE 0 END)/2 as Vlu_2_,
SUM(CASE WHEN Vlu>=0 THEN Vlu ELSE 0 END)/1 as Vlu_1, SUM(CASE WHEN Vlu<0 THEN Vlu ELSE 0 END)/1 as Vlu_1_,
MIN(CASE WHEN Vlu>0 THEN Vlu END) as Mn, MAX(CASE WHEN Vlu<0 THEN Vlu END) as MX_,
COUNT(CASE WHEN Vlu>0 THEN Vlu END) AS SM, COUNT(CASE WHEN Vlu<0 THEN Vlu END) AS SM_
FROM #TMP_STEP_2_UP
GROUP BY ProjectID, VOPPBT
) T
DROP TABLE #TMP_STEP_2_UP;
DROP TABLE #TMP_STEP_2;
--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沿
@ -458,9 +534,9 @@ FROM obpm_LianCheng_Data.dbo.TLK_小区信息管理 A
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 h
on a.ITEM_PROPERTYLEVEL=h.ITEM_DICVALUE and h.ITEM_DICTYPE='物业档次'
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 g
on a.ITEM_RAPropertyType=g.ITEM_DICVALUE and g.ITEM_DICTYPE='居住物业类型'
on a.ITEM_RAPropertyType=g.ITEM_DICVALUE and g.ITEM_DICTYPE='物业类型'
left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 i
on a.ITEM_RAType=g.ITEM_DICVALUE and i.ITEM_DICTYPE='小区类型'
on a.ITEM_RAType=i.ITEM_DICVALUE and i.ITEM_DICTYPE='小区类型'
LEFT JOIN ODS_PROJECT_PRICE_INFO_#lastYearMonth# D
ON A.ITEM_AIRAID = D.ProjectID
where A.ITEM_PROJECTTYPE='1' and a.ITEM_ISBUILDINDEX='1' and D.Status=1;

View File

@ -0,0 +1,214 @@
truncate table ODS_PROJECT_PRICE_INFO_#yearMonth#;
insert into ODS_PROJECT_PRICE_INFO_#yearMonth#
select ProjectID, 1 PriceType, BasePriceDft, MainPriceDft, AreaCoff, YearCoff, VOPPAT, VOPPA, '#priceDate#', PriceNote, '#priceDate#', 1, NULL ---AdjEvd下期调整
from DWA_PROJECTBASEPRICE_IMDT_#yearMonth# a
--
select a.ProjectID,
case when b.ProjectID is null then 1 else 0 end as PriceTableAdd,
case when c.ProjectID is null then 1 else 0 end as PriceTableAdd_1,
case when d.ITEM_AIRAID is null then 1 else 0 end as InfoTableAdd
into #ProjectAdd
from DWA_PROJECTBASEPRICE_MANU_#yearMonth# a
left join ODS_PROJECT_PRICE_INFO_#yearMonth# b
on a.ProjectID = b.ProjectID and b.Status=1
left join ODS_PROJECT_PRICE_INFO_#lastYearMonth# c
on a.ProjectID = c.ProjectID and c.Status=1
left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 d
on a.ProjectID = d.ITEM_AIRAID and d.ITEM_PROJECTTYPE='1' and d.ITEM_ISBUILDINDEX='1'
where b.ProjectID is null or c.ProjectID is null or d.ITEM_AIRAID is null;
-------DWA_PROJECTBASEPRICE_MANU_201902记录有更新
-------
select a.ProjectID, a.IsIndxGen, a.IsPstCalc, a.StatusRun, a.ProjectType, a.ProjectTypeDtl, a.ProjectLevel, a.[Year], a.MainArea, a.AreaCoff, a.YearCoff,
a.BasePriceDft as BasePrice, a.BasePrice_1, a.PriceNote, a.VOPPAT, a.VOPPA, getdate() as ModifyDate,
case when b.ProjectID is not null and isnull(a.BasePriceDft, 0) <> isnull(b.BasePrice, 0) then 1 else 0 end as PriceChg, --
case when b.ProjectID is not null and isnull(a.priceNote, '') <> isnull(b.priceNote, '') then 1 else 0 end as PriceNoteChg, -- 指当期价格说明字段变化
case when b.ProjectID is not null and isnull(a.AreaCoff,1) <> isnull(b.AreaCoff,1) then 1 else 0 end as AreaCoffChg, -- 指当期面积修正系数字段变化
case when b.ProjectID is not null and isnull(a.YearCoff,1) <> isnull(b.YearCoff,1) then 1 else 0 end as YearCoffChg, -- 指当期年代修正系数字段变化
case when b.ProjectID is not null and isnull(a.VOPPAT,'') <> isnull(b.VOPPAT,'') then 1 else 0 end as VOPPATChg, -- 指当期价格涨跌幅类型字段变化
case when b.ProjectID is not null and isnull(a.VOPPA,0) <> isnull(b.VOPPA,0) then 1 else 0 end as VOPPAChg, -- 指当期价格涨跌幅字段变化
case when c.ProjectID is not null then 1 else 0 end as Price_1Chg -- 指上期基价变化
into #InfoChg
from DWA_PROJECTBASEPRICE_MANU_#yearMonth# a
left join ODS_PROJECT_PRICE_INFO_#yearMonth# b
on a.ProjectID = b.ProjectID and b.status=1 and (
isnull(a.BasePriceDft, 0) <> isnull(b.BasePrice, 0) or
isnull(a.priceNote, '') <> isnull(b.priceNote, '') or
isnull(a.AreaCoff,1) <> isnull(b.AreaCoff,1) or
isnull(a.YearCoff,1) <> isnull(b.YearCoff,1) or
isnull(a.VOPPAT,'') <> isnull(b.VOPPAT,'') or
isnull(a.VOPPA,0) <> isnull(b.VOPPA,0))
left join ODS_PROJECT_PRICE_INFO_#lastYearMonth# c
on a.ProjectID = c.ProjectID and isnull(a.BasePrice_1,0) <> isnull(c.BasePrice,0) and c.status=1
where b.ProjectID is not null or c.ProjectID is not null;
select a.ProjectID, 1 PriceType, b.BasePrice,
b.BasePrice*1.0*isnull(b.AreaCoff,1)*isnull(b.YearCoff,1) as MainPrice,
isnull(b.AreaCoff,1) as AreaCoff, isnull(b.YearCoff, 1) as YearCoff,
b.VOPPAT, b.VOPPA, a.PriceDate, b.PriceNote, b.ModifyDate, 1 as Status,
case when PriceChg=0 then '' else 'PriceChg|' end + case when PriceNoteChg=0 then '' else 'PriceNoteChg|' end +
case when AreaCoffChg=0 then '' else 'AreaCoffChg|' end + case when YearCoffChg=0 then '' else 'YearCoffChg|' end +
case when VOPPATChg=0 then '' else 'VOPPATChg|' end + case when VOPPAChg=0 then '' else 'VOPPAChg|' end as AdjEvd
into #InfoChgCurr
from ODS_PROJECT_PRICE_INFO_#yearMonth# a
inner join #InfoChg b
on a.ProjectID = b.ProjectID
where (b.PriceChg=1 or b.PriceNoteChg=1 or b.AreaCoffChg=1 or b.YearCoffChg=1 or b.VOPPATChg=1 or b.VOPPAChg=1) and a.status=1;
update a
set a.Status = 0
from ODS_PROJECT_PRICE_INFO_#yearMonth# a
left join #InfoChgCurr b
on a.ProjectID = b.ProjectID
where b.ProjectID is not null and a.status=1;
insert into ODS_PROJECT_PRICE_INFO_#yearMonth#
select * from #InfoChgCurr;
select a.ProjectID, 1 PriceType, b.BasePrice_1, b.BasePrice_1*1.0*isnull(a.AreaCoff,1)*isnull(a.YearCoff,1) as MainPrice, a.AreaCoff, a.YearCoff,
a.VOPPAT, a.VOPPA, a.PriceDate, b.PriceNote, b.ModifyDate, 1 as Status,'Price_1Chg|' as AdjEvd
into #InfoChgLst
from ODS_PROJECT_PRICE_INFO_#lastYearMonth# a
inner join #InfoChg b
on a.ProjectID = b.ProjectID
where b.Price_1Chg=1 and a.status=1;
update a
set Status = 0
from ODS_PROJECT_PRICE_INFO_#lastYearMonth# a
left join #InfoChgLst b
on a.ProjectID = b.ProjectID
where b.ProjectID is not null and a.status=1;
insert into ODS_PROJECT_PRICE_INFO_#lastYearMonth#
select * from #InfoChgLst;
--
INSERT INTO ODS_PROJECT_PRICE_INFO_#yearMonth#
SELECT A.ProjectID, 1 AS PriceType, A.BasePriceDft, A.MainPriceDft, AreaCoff, YearCoff, VOPPAT, VOPPA, '#priceDate#' AS PriceDate, PriceNote, '#priceDate#' AS ModifyDate, 1 Status, 'NewAdded' AdjEvd
FROM DWA_PROJECTBASEPRICE_MANU_#yearMonth# A
INNER JOIN #ProjectAdd B
ON A.ProjectID = B.ProjectID AND B.PriceTableAdd = 1;
INSERT INTO ODS_PROJECT_PRICE_INFO_#lastYearMonth#
SELECT A.ProjectID, 1 AS PriceType, BasePrice_1, BasePrice_1*1.0*ISNULL(AreaCoff,1)*ISNULL(YearCoff,1) MainPrice,
AreaCoff, YearCoff, NULL VOPPAT, NULL VOPPA, '#lastPriceDate#' AS PriceDate, PriceNote, '#priceDate#' AS ModifyDate, 1 Status, 'NewAdded_1' AdjEvd
FROM DWA_PROJECTBASEPRICE_MANU_#yearMonth# A
INNER JOIN #ProjectAdd B
ON A.ProjectID = B.ProjectID AND B.PriceTableAdd_1 = 1;
drop table #InfoChg;
drop table #InfoChgCurr;
drop table #InfoChgLst;
drop table #ProjectAdd;
-- 上月
update a
set a.ITEM_STANDARDPRICE = b.BasePrice,a.ITEM_MAINAREAPRICE=b.MainPrice
from obpm_LianCheng_Data.dbo.TLK_基价信息 a
join dbo.ODS_PROJECT_PRICE_INFO_#lastYearMonth# b
on a.ITEM_AIRAID = b.ProjectID
where b.Status = 1
and a.ITEM_VALUEPOINT = '#lastPriceDate#'
and a.ITEM_PRICETYPE = '1'
and a.ITEM_PROJECTTYPE = '1'
and (
a.ITEM_STANDARDPRICE <> b.BasePrice or
a.ITEM_MAINAREAPRICE <> b.MainPrice
);
--
insert into obpm_LianCheng_Data.dbo.TLK_基价信息
(
ID
, LASTMODIFIED
, FORMNAME
, AUTHOR
, AUTHOR_DEPT_INDEX
, CREATED
, FORMID
, ISTMP
, VERSIONS
, APPLICATIONID
, LASTMODIFIER
, DOMAINID
, ITEM_PriceID
, ITEM_AIRAID
, ITEM_PROJECTTYPE
, ITEM_PRICETYPE
, ITEM_STANDARDPRICE
, ITEM_MAINAREAPRICE
, ITEM_VALUEPOINT
, ITEM_PRICEEXPLAIN
, ITEM_UPDATEPERSON
, ITEM_UPDATEDATE
, ITEM_PRICECHG
)
select newid()
, getdate()
, '物业信息管理/基价信息'
, 'amQRUkvYQAsAec1JGLp'
, 'amQRUkvYQAsAec1JGLp'
, getdate()
, 'ybte0OakLV17UzAyoVU'
, 0
, 1
, 'Ts7TykYmuEzzZgWhXHj'
, 'amQRUkvYQAsAec1JGLp'
, 'BclzHtmfLQoAA5ICTb5'
, newid()
, ProjectID
, 1
, 1
, BasePrice
, MainPrice
, '#priceDate#'
, PriceNote
, '李贺'
, getdate()
, VOPPA
from dbo.ODS_PROJECT_PRICE_INFO_#yearMonth#
where Status = 1;
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 a.ID
, a.LASTMODIFIED
, a.FORMNAME
, a.AUTHOR
, a.AUTHOR_DEPT_INDEX
, a.CREATED
, a.FORMID
, a.ISTMP
, a.VERSIONS
, a.APPLICATIONID
, a.LASTMODIFIER
, a.DOMAINID
, a.AUDITORLIST
, a.COAUDITORLIST
, a.id
from obpm_LianCheng_Data.dbo.TLK_基价信息 a
left join obpm_LianCheng_Data.dbo.T_DOCUMENT b
on a.ID = b.ID
where a.ITEM_VALUEPOINT = '#priceDate#'
and a.ITEM_PROJECTTYPE = '1'
and a.ITEM_PRICETYPE = '1';