feature(优化成交案例查询):

1. 接入es提升查询效率
2. 配置一套module,查询买卖成交案例
This commit is contained in:
purple 2020-08-10 18:57:46 +08:00
parent 23cb131206
commit 4728593c7b
31 changed files with 1490 additions and 306 deletions

View File

@ -0,0 +1,50 @@
import request from '@/utils/request'
// 调用es查询案例
// 1. 模糊搜索地址
// 2. 模糊搜索小区
// 查询最终住宅租赁基价列表
export function list(query) {
return request({
url: '/basic/cases/closing/list',
method: 'get',
params: query
})
}
// // 查询最终住宅租赁基价详细
export function findByText(text) {
return request({
url: '/basic/cases/closing/query?text=' + text,
method: 'get'
})
}
// // 修改最终住宅租赁基价
// export function update(data) {
// return request({
// url: '/data/rent-price/residence/ultimate',
// method: 'put',
// data: data
// })
// }
// // 导出最终住宅租赁基价
// export function export2File(query) {
// return request({
// url: '/data/rent-price/residence/ultimate/export',
// method: 'get',
// params: query
// })
// }
// // 查询人工住宅租赁 年月 列表
// export function getYearMonthList() {
// return request({
// url: '/data/rent-price/residence/ultimate/yearmonth',
// method: 'get'
// })
// }

View File

@ -0,0 +1,178 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="成交ID" prop="dealId">
<el-input
v-model="queryParams.dealId"
placeholder="请输入成交ID"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="案例小区名称" prop="caseCommunityName">
<el-input
v-model="queryParams.caseCommunityName"
placeholder="请输入案例小区名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="案例地址" prop="caseAddress">
<!-- <el-input
v-model="queryParams.caseAddress"
placeholder="请输入案例地址"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>-->
<template>
<el-select
v-model="address"
remote
filterable
placeholder="请输入案例地址"
:remote-method="findDealId"
:loading="loading"
@change="dealIdChange"
>
<el-option
v-for="item in dealIdList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</template>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dataList" style="width: 100%;">
<el-table-column label="成交id" align="center" prop="dealId" :show-overflow-tooltip="true" />
<el-table-column label="成交类型" align="center" prop="dealType" :show-overflow-tooltip="true" />
<el-table-column label="案例地理位置(区域、板块、环线)" align="center" prop="location" />
<el-table-column label="案例小区名称" align="center" prop="caseCommunityName" />
<el-table-column label="案例签约日期" align="center" prop="caseContractDate" />
<el-table-column label="案例面积" align="center" prop="caseArea" width="180">
<!-- <template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>-->
</el-table-column>
<el-table-column label="案例楼层" align="center" prop="caseFloor" />
<el-table-column label="案例户型" align="center" prop="caseApartmentLayout" />
<el-table-column label="案例总价(万元)" align="center" prop="caseTotalPrice" />
<el-table-column label="案例单价(元/㎡)" align="center" prop="caseUnitPrice" />
<el-table-column label="案例房屋类型" align="center" prop="caseHouseType" />
<el-table-column label="案例房屋性质" align="center" prop="caseHouseProperty" />
<el-table-column label="案例月份" align="center" prop="caseYearMonth" />
<el-table-column label="标准小区ID" align="center" prop="communityId" />
<el-table-column
label="标准楼栋ID"
align="center"
prop="buildingId"
:show-overflow-tooltip="true"
/>
<el-table-column label="标准单套ID" align="center" prop="condoId" :show-overflow-tooltip="true" />
<el-table-column
label="清洗物业类型"
align="center"
prop="propertyType"
:show-overflow-tooltip="true"
/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageIndex"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { list, findByText } from "@/api/data/uvClosingCase";
export default {
name: "uvClosingCase",
data() {
return {
//
loading: true,
//
total: 0,
//
dataList: [],
//
dealIdList: [],
//
address: undefined,
//
queryParams: {
dealId: undefined,
caseCommunityName: undefined,
caseAddress: undefined,
pageIndex: 1,
pageSize: 20
}
};
},
created() {
this.getList();
},
methods: {
/** 查询登录日志列表 */
getList() {
this.loading = true;
list(this.queryParams).then(response => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.pageIndex = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
dealIdChange(val) {
this.queryParams.dealId = val;
},
findDealId(text) {
if (text) {
this.loading = true;
findByText(text).then(response => {
this.dealIdList = [];
var arr = new Array();
for (var i = 0; i < response.rows.length; i++) {
arr.push({
value: response.rows[i]["dealId"],
label:
response.rows[i]["countryName"] +
" " +
response.rows[i]["cleanAddress"]
});
}
this.dealIdList = arr;
this.loading = false;
});
}
}
}
};
</script>

View File

@ -278,6 +278,39 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.6.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>6.6.2</version>
</dependency>
<!-- elasticsearch-rest-high-level-client -->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.6.2</version>
<exclusions>
<exclusion>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,34 @@
package com.ruoyi.common.exception;
/**
* es异常
*
* @author lihe
*/
public class ElasticsearchException extends RuntimeException {
private String errmsg;
public String getErrmsg() {
return errmsg;
}
public ElasticsearchException(String message) {
super(message);
}
public ElasticsearchException(String message, Throwable cause) {
super(message, cause);
}
public ElasticsearchException(Throwable cause) {
super(cause);
}
public ElasticsearchException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.framework.config;
import com.ruoyi.common.utils.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List;
/**
* ElasticsearchAutoConfiguration
*
* @author fxbin
* @version v1.0
* @since 2019/9/15 22:59
*/
@Configuration
@EnableConfigurationProperties(ElasticsearchProperties.class)
public class ElasticsearchAutoConfiguration {
private final ElasticsearchProperties elasticsearchProperties;
public ElasticsearchAutoConfiguration(ElasticsearchProperties elasticsearchProperties) {
this.elasticsearchProperties = elasticsearchProperties;
}
private List<HttpHost> httpHosts = new ArrayList<>();
@Bean
@ConditionalOnMissingBean
public RestHighLevelClient restHighLevelClient() {
List<String> clusterNodes = elasticsearchProperties.getClusterNodes();
clusterNodes.forEach(node -> {
try {
String[] parts = StringUtils.split(node, ":");
Assert.notNull(parts, "Must defined");
Assert.state(parts.length == 2, "Must be defined as 'host:port'");
httpHosts.add(new HttpHost(parts[0], Integer.parseInt(parts[1]), elasticsearchProperties.getSchema()));
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + node + "'", e);
}
});
RestClientBuilder builder = RestClient.builder(httpHosts.toArray(new HttpHost[0]));
return getRestHighLevelClient(builder, elasticsearchProperties);
}
/**
* get restHistLevelClient
*
* @param builder RestClientBuilder
* @param elasticsearchProperties elasticsearch default properties
* @return {@link org.elasticsearch.client.RestHighLevelClient}
* @author fxbin
*/
private static RestHighLevelClient getRestHighLevelClient(RestClientBuilder builder,
ElasticsearchProperties elasticsearchProperties) {
// Callback used the default {@link RequestConfig} being set to the {@link CloseableHttpClient}
builder.setRequestConfigCallback(requestConfigBuilder -> {
requestConfigBuilder.setConnectTimeout(elasticsearchProperties.getConnectTimeout());
requestConfigBuilder.setSocketTimeout(elasticsearchProperties.getSocketTimeout());
requestConfigBuilder.setConnectionRequestTimeout(elasticsearchProperties.getConnectionRequestTimeout());
return requestConfigBuilder;
});
// Callback used to customize the {@link CloseableHttpClient} instance used by a {@link RestClient} instance.
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.setMaxConnTotal(elasticsearchProperties.getMaxConnectTotal());
httpClientBuilder.setMaxConnPerRoute(elasticsearchProperties.getMaxConnectPerRoute());
return httpClientBuilder;
});
// Callback used the basic credential auth
ElasticsearchProperties.Account account = elasticsearchProperties.getAccount();
if (!StringUtils.isEmpty(account.getUsername()) && !StringUtils.isEmpty(account.getUsername())) {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(account.getUsername(),
account.getPassword()));
}
return new RestHighLevelClient(builder);
}
}

View File

@ -0,0 +1,212 @@
package com.ruoyi.framework.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
* 自定义es配置
*
* @author lihe
*/
@ConfigurationProperties(prefix = "ruoyi.data.elasticsearch")
public class ElasticsearchProperties {
/**
* 请求协议
*/
private String schema = "http";
/**
* 集群名称
*/
private String clusterName = "elasticsearch";
/**
* 集群节点
*/
@NotNull(message = "集群节点不允许为空")
private List<String> clusterNodes = new ArrayList<>();
/**
* 连接超时时间(毫秒)
*/
private Integer connectTimeout = 1000;
/**
* socket 超时时间
*/
private Integer socketTimeout = 30000;
/**
* 连接请求超时时间
*/
private Integer connectionRequestTimeout = 500;
/**
* 每个路由的最大连接数量
*/
private Integer maxConnectPerRoute = 10;
/**
* 最大连接总数量
*/
private Integer maxConnectTotal = 30;
/**
* 索引配置信息
*/
private Index index = new Index();
/**
* 认证账户
*/
private Account account = new Account();
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public List<String> getClusterNodes() {
return clusterNodes;
}
public void setClusterNodes(List<String> clusterNodes) {
this.clusterNodes = clusterNodes;
}
public Integer getConnectTimeout() {
return connectTimeout;
}
public void setConnectTimeout(Integer connectTimeout) {
this.connectTimeout = connectTimeout;
}
public Integer getSocketTimeout() {
return socketTimeout;
}
public void setSocketTimeout(Integer socketTimeout) {
this.socketTimeout = socketTimeout;
}
public Integer getConnectionRequestTimeout() {
return connectionRequestTimeout;
}
public void setConnectionRequestTimeout(Integer connectionRequestTimeout) {
this.connectionRequestTimeout = connectionRequestTimeout;
}
public Integer getMaxConnectPerRoute() {
return maxConnectPerRoute;
}
public void setMaxConnectPerRoute(Integer maxConnectPerRoute) {
this.maxConnectPerRoute = maxConnectPerRoute;
}
public Integer getMaxConnectTotal() {
return maxConnectTotal;
}
public void setMaxConnectTotal(Integer maxConnectTotal) {
this.maxConnectTotal = maxConnectTotal;
}
public Index getIndex() {
return index;
}
public void setIndex(Index index) {
this.index = index;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
/**
* 索引配置信息
*/
public static class Index {
/**
* 分片数量
*/
private Integer numberOfShards = 3;
/**
* 副本数量
*/
private Integer numberOfReplicas = 2;
public Integer getNumberOfShards() {
return numberOfShards;
}
public void setNumberOfShards(Integer numberOfShards) {
this.numberOfShards = numberOfShards;
}
public Integer getNumberOfReplicas() {
return numberOfReplicas;
}
public void setNumberOfReplicas(Integer numberOfReplicas) {
this.numberOfReplicas = numberOfReplicas;
}
}
/**
* 认证账户
*/
public static class Account {
/**
* 认证用户
*/
private String username;
/**
* 认证密码
*/
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
}

View File

@ -16,6 +16,9 @@ public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
private Integer offset;
private Integer limit;
/** 搜索值 */
private String searchValue;
@ -153,4 +156,21 @@ public class BaseEntity implements Serializable
{
this.params = params;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
}

View File

@ -2,6 +2,7 @@ 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;
@ -19,12 +20,11 @@ import com.ruoyi.framework.web.domain.AjaxResult;
/**
* 通用请求处理
*
*
* @author ruoyi
*/
@RestController
public class CommonController
{
public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
@ -32,34 +32,30 @@ public class CommonController
/**
* 通用下载请求
*
*
* @param fileName 文件名称
* @param delete 是否删除
* @param delete 是否删除
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.isValidFilename(fileName))
{
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 realFileName =
fileName.substring(0, fileName.indexOf("_")) + fileName.substring(fileName.lastIndexOf("."));
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition",
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, fileName));
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
if (delete) {
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
@ -68,10 +64,8 @@ public class CommonController
* 通用上传请求
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
public AjaxResult uploadFile(MultipartFile file) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
@ -81,9 +75,7 @@ public class CommonController
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@ -92,8 +84,7 @@ public class CommonController
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
{
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址

View File

@ -0,0 +1,69 @@
package com.ruoyi.project.data.basis.controller;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
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.basis.domain.LianJiaCommunityDict;
import com.ruoyi.project.data.basis.domain.UvClosingCase;
import com.ruoyi.project.data.basis.domain.UvTradingCase;
import com.ruoyi.project.data.basis.service.ILianJiaCommunityDictService;
import com.ruoyi.project.data.basis.service.IUvClosingCaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 联城案例Controller
*
* @author lihe
*/
@RestController
@RequestMapping("/basic/cases")
public class UvCaseController extends BaseController {
@Autowired
private IUvClosingCaseService uvClosingCaseService;
@Autowired
private ILianJiaCommunityDictService lianJiaCommunityDictService;
/**
* 列表页面
*
* @param closingCase
* @return
*/
@PreAuthorize("@ss.hasPermi('cases:uvClosingCase:list')")
@GetMapping("/closing/list")
public TableDataInfo closingCaseList(UvClosingCase closingCase) {
int pageIndex = ServletUtils.getParameterToInt("pageIndex");
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
closingCase.setOffset(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
closingCase.setLimit(pageSize);
int total = uvClosingCaseService.pageCount(closingCase);
List<UvClosingCase> list = uvClosingCaseService.pageList(closingCase);
return getDataTable(list, total);
}
/**
* es的模糊查找
*
* @param text
* @return
*/
@PreAuthorize("@ss.hasPermi('cases:uvClosingCase:list')")
@GetMapping("/closing/query")
public TableDataInfo closingCaseInESList(@RequestParam("text") String text) {
List<UvTradingCase> list = uvClosingCaseService.findByText(text);
return getDataTable(list, list.size());
}
}

View File

@ -28,12 +28,12 @@ public class UVBasePrice extends BaseEntity {
/**
* 基价售价租金
*/
@Excel(name = "主力基价", cellType = Excel.ColumnType.NUMERIC)
@Excel(name = "主力基价")
private BigDecimal standardPrice;
/**
* 主力面积基价售价租金
*/
@Excel(name = "主力面积基价", cellType = Excel.ColumnType.NUMERIC)
@Excel(name = "主力面积基价")
private BigDecimal mainAreaPrice;
/**
* 价值时点

View File

@ -0,0 +1,269 @@
package com.ruoyi.project.data.basis.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 联城买卖成交案例
*
* @author lihe
*/
public class UvClosingCase extends BaseEntity {
/**
* pk 案例id(唯一)
*/
private String dealId;
/**
* 案例类型(一手二手)
*/
private String dealType;
/**
* 区域
*/
private String caseDistrict;
private String caseBlock;
private String caseLoop;
/**
* 总价
*/
private BigDecimal caseTotalPrice;
/**
* 单价
*/
private BigDecimal caseUnitPrice;
/**
* 案例小区名称
*/
private String caseCommunityName;
/**
* 案例地址
*/
private String caseAddress;
/**
* 案例面积
*/
private BigDecimal caseArea;
/**
* 案例房屋类型
*/
private String caseHouseType;
/**
* 案例房屋性质
*/
private String caseHouseProperty;
/**
* 签约日期
*/
private Date caseContractDate;
/**
* 楼层
*/
private String caseFloor;
/**
* 案例房型
*/
private String caseApartmentLayout;
/**
* 物业类型
*/
private String propertyType;
/**
* 小区id
*/
private String communityId;
private String communityName;
/**
* 楼栋id
*/
private String buildingId;
private String buildingName;
/**
* 单套id
*/
private String condoId;
private String condoName;
public String getDealId() {
return dealId;
}
public void setDealId(String dealId) {
this.dealId = dealId;
}
public String getDealType() {
return dealType;
}
public void setDealType(String dealType) {
this.dealType = dealType;
}
public String getCaseDistrict() {
return caseDistrict;
}
public void setCaseDistrict(String caseDistrict) {
this.caseDistrict = caseDistrict;
}
public String getCaseBlock() {
return caseBlock;
}
public void setCaseBlock(String caseBlock) {
this.caseBlock = caseBlock;
}
public String getCaseLoop() {
return caseLoop;
}
public void setCaseLoop(String caseLoop) {
this.caseLoop = caseLoop;
}
public BigDecimal getCaseTotalPrice() {
return caseTotalPrice;
}
public void setCaseTotalPrice(BigDecimal caseTotalPrice) {
this.caseTotalPrice = caseTotalPrice;
}
public BigDecimal getCaseUnitPrice() {
return caseUnitPrice;
}
public void setCaseUnitPrice(BigDecimal caseUnitPrice) {
this.caseUnitPrice = caseUnitPrice;
}
public String getCaseCommunityName() {
return caseCommunityName;
}
public void setCaseCommunityName(String caseCommunityName) {
this.caseCommunityName = caseCommunityName;
}
public String getCaseAddress() {
return caseAddress;
}
public void setCaseAddress(String caseAddress) {
this.caseAddress = caseAddress;
}
public BigDecimal getCaseArea() {
return caseArea;
}
public void setCaseArea(BigDecimal caseArea) {
this.caseArea = caseArea;
}
public String getCaseHouseType() {
return caseHouseType;
}
public void setCaseHouseType(String caseHouseType) {
this.caseHouseType = caseHouseType;
}
public String getCaseHouseProperty() {
return caseHouseProperty;
}
public void setCaseHouseProperty(String caseHouseProperty) {
this.caseHouseProperty = caseHouseProperty;
}
public Date getCaseContractDate() {
return caseContractDate;
}
public void setCaseContractDate(Date caseContractDate) {
this.caseContractDate = caseContractDate;
}
public String getCaseFloor() {
return caseFloor;
}
public void setCaseFloor(String caseFloor) {
this.caseFloor = caseFloor;
}
public String getPropertyType() {
return propertyType;
}
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getCondoId() {
return condoId;
}
public void setCondoId(String condoId) {
this.condoId = condoId;
}
public String getCommunityName() {
return communityName;
}
public void setCommunityName(String communityName) {
this.communityName = communityName;
}
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getCondoName() {
return condoName;
}
public void setCondoName(String condoName) {
this.condoName = condoName;
}
public String getCaseApartmentLayout() {
return caseApartmentLayout;
}
public void setCaseApartmentLayout(String caseApartmentLayout) {
this.caseApartmentLayout = caseApartmentLayout;
}
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.project.data.basis.domain;
import java.io.Serializable;
/**
* 联城买卖成交案例
*
* @author lihe
*/
public class UvTradingCase implements Serializable {
private static final long serialVersionUID = 8510634155374943623L;
/**
* 主键
*/
private Long id;
/**
* 案例id
*/
private String dealId;
/**
* 模糊地址
*/
private String cleanAddress;
/**
* 区域
*/
private String countryName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDealId() {
return dealId;
}
public void setDealId(String dealId) {
this.dealId = dealId;
}
public String getCleanAddress() {
return cleanAddress;
}
public void setCleanAddress(String cleanAddress) {
this.cleanAddress = cleanAddress;
}
public String getCountryName() {
return countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.project.data.basis.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.basis.domain.ClosingCaseAddress;
import com.ruoyi.project.data.basis.domain.UvClosingCase;
import java.util.List;
/**
* 联城数库买卖成交案例
*
* @author lihe
*/
@DS("teemlink")
public interface UvClosingCaseMapper {
/**
* 总数
*
* @param queryModel
* @return
*/
int selectPageCount(UvClosingCase queryModel);
/**
* 分页查询
*
* @param queryModel
* @return
*/
List<UvClosingCase> selectPageList(UvClosingCase queryModel);
}

View File

@ -0,0 +1,195 @@
package com.ruoyi.project.data.basis.service;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.exception.ElasticsearchException;
import com.ruoyi.framework.config.ElasticsearchProperties;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.HttpAsyncResponseConsumerFactory;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Map;
public abstract class BaseElasticsearchService {
private static Logger log = LoggerFactory.getLogger(BaseElasticsearchService.class);
@Resource
protected RestHighLevelClient client;
@Resource
private ElasticsearchProperties elasticsearchProperties;
protected static final RequestOptions COMMON_OPTIONS;
static {
RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
// 默认缓冲限制为100MB此处修改为30MB
builder.setHttpAsyncResponseConsumerFactory(new HttpAsyncResponseConsumerFactory.HeapBufferedResponseConsumerFactory(30 * 1024 * 1024));
COMMON_OPTIONS = builder.build();
}
/**
* create elasticsearch index (asyc)
*
* @param index elasticsearch index
* @author fxbin
*/
protected void createIndexRequest(String index) {
try {
CreateIndexRequest request = new CreateIndexRequest(index);
// Settings for this index
request.settings(Settings.builder().put("index.number_of_shards",
elasticsearchProperties.getIndex().getNumberOfShards()).put("index.number_of_replicas",
elasticsearchProperties.getIndex().getNumberOfReplicas()));
CreateIndexResponse createIndexResponse = client.indices().create(request, COMMON_OPTIONS);
log.info(" whether all of the nodes have acknowledged the request : {}",
createIndexResponse.isAcknowledged());
log.info(" Indicates whether the requisite number of shard copies were started for each shard in the " +
"index before timing out :{}", createIndexResponse.isShardsAcknowledged());
} catch (IOException e) {
throw new ElasticsearchException("创建索引 {" + index + "} 失败");
}
}
/**
* delete elasticsearch index
*
* @param index elasticsearch index name
* @author fxbin
*/
protected void deleteIndexRequest(String index) {
DeleteIndexRequest deleteIndexRequest = buildDeleteIndexRequest(index);
try {
client.indices().delete(deleteIndexRequest, COMMON_OPTIONS);
} catch (IOException e) {
throw new ElasticsearchException("删除索引 {" + index + "} 失败");
}
}
/**
* build DeleteIndexRequest
*
* @param index elasticsearch index name
* @author fxbin
*/
private static DeleteIndexRequest buildDeleteIndexRequest(String index) {
return new DeleteIndexRequest(index);
}
/**
* build IndexRequest
*
* @param index elasticsearch index name
* @param id request object id
* @param object request object
* @return {@link org.elasticsearch.action.index.IndexRequest}
* @author fxbin
*/
protected static IndexRequest buildIndexRequest(String index, String id, Object object) {
return new IndexRequest(index).id(id).source(BeanUtil.beanToMap(object), XContentType.JSON);
}
/**
* exec updateRequest
*
* @param index elasticsearch index name
* @param id Document id
* @param object request object
* @author fxbin
*/
protected void updateRequest(String index, String id, Object object) {
try {
UpdateRequest updateRequest = new UpdateRequest(index, "", id).doc(BeanUtil.beanToMap(object),
XContentType.JSON);
client.update(updateRequest, COMMON_OPTIONS);
} catch (IOException e) {
throw new ElasticsearchException("更新索引 {" + index + "} 数据 {" + object + "} 失败");
}
}
/**
* exec deleteRequest
*
* @param index elasticsearch index name
* @param id Document id
* @author fxbin
*/
protected void deleteRequest(String index, String id) {
try {
DeleteRequest deleteRequest = new DeleteRequest(index, "", id);
client.delete(deleteRequest, COMMON_OPTIONS);
} catch (IOException e) {
throw new ElasticsearchException("删除索引 {" + index + "} 数据id {" + id + "} 失败");
}
}
/**
* search all
*
* @param index elasticsearch index name
* @return {@link SearchResponse}
* @author fxbin
*/
protected SearchResponse search(String index) {
SearchRequest searchRequest = new SearchRequest(index);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchAllQuery());
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = null;
try {
searchResponse = client.search(searchRequest, COMMON_OPTIONS);
} catch (IOException e) {
e.printStackTrace();
}
return searchResponse;
}
/**
* 查询
*
* @param index
* @param params
* @return
*/
protected SearchResponse search(String index, Map<String, Object> params) {
SearchRequest searchRequest = new SearchRequest(index);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
if (null != params) {
for (Map.Entry<String, Object> item : params.entrySet()) {
boolQueryBuilder.must().add(QueryBuilders.matchQuery(item.getKey(), item.getValue()));
}
}
searchSourceBuilder.from(0).size(20).query(boolQueryBuilder);
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = null;
try {
searchResponse = client.search(searchRequest, COMMON_OPTIONS);
} catch (IOException e) {
e.printStackTrace();
}
return searchResponse;
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.project.data.basis.service;
import com.ruoyi.project.data.basis.domain.UVBasePrice;
import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel;
import com.ruoyi.project.data.basis.domain.UvClosingCase;
import com.ruoyi.project.data.basis.domain.UvTradingCase;
import java.util.List;
/**
* 联城数库买卖成交案例
*
* @author lihe
*/
public interface IUvClosingCaseService {
/**
* 分页查询
*
* @param queryModel
* @return
*/
List<UvClosingCase> pageList(UvClosingCase queryModel);
/**
* 分页数量
*
* @param queryModel
* @return
*/
Integer pageCount(UvClosingCase queryModel);
/**
* 查询es地址
*
* @param text
* @return
*/
List<UvTradingCase> findByText(String text);
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.project.data.basis.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.project.data.basis.domain.UvClosingCase;
import com.ruoyi.project.data.basis.domain.UvTradingCase;
import com.ruoyi.project.data.basis.mapper.UvClosingCaseMapper;
import com.ruoyi.project.data.basis.service.BaseElasticsearchService;
import com.ruoyi.project.data.basis.service.IUvClosingCaseService;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.search.SearchHit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* 案例查询实现
*
* @author lihe
*/
@Service
public class UvClosingCaseServiceImpl extends BaseElasticsearchService implements IUvClosingCaseService {
@Autowired
private UvClosingCaseMapper uvClosingCaseMapper;
@Override
public List<UvClosingCase> pageList(UvClosingCase queryModel) {
return uvClosingCaseMapper.selectPageList(queryModel);
}
@Override
public Integer pageCount(UvClosingCase queryModel) {
return uvClosingCaseMapper.selectPageCount(queryModel);
}
@Override
public List<UvTradingCase> findByText(String text) {
Map<String, Object> params = new HashMap<>();
params.put("cleanAddress",text);
SearchResponse searchResponse = search("trading",params);
SearchHit[] hits = searchResponse.getHits().getHits();
List<UvTradingCase> caseList = new ArrayList<>();
Arrays.stream(hits).forEach(hit -> {
Map<String, Object> sourceAsMap = hit.getSourceAsMap();
UvTradingCase person = BeanUtil.mapToBean(sourceAsMap, UvTradingCase.class, true);
caseList.add(person);
});
return caseList;
}
}

View File

@ -10,4 +10,11 @@ public interface IOriginalResidenceRentClosingCaseService {
* 数据下载
*/
void pullData();
/**
* 推送数据
* @param yearMonth
* @param currentPriceTableRoute
*/
void pushAggregateCase(Integer yearMonth, Integer currentPriceTableRoute);
}

View File

@ -3,11 +3,14 @@ package com.ruoyi.project.data.cases.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.LoadUtil;
import com.ruoyi.project.data.cases.domain.CleanResidenceRentAggregationCase;
import com.ruoyi.project.data.cases.domain.OriginalResidenceRentClosingCase;
import com.ruoyi.project.data.cases.domain.OtherResidenceRentClosingCase;
import com.ruoyi.project.data.cases.mapper.OriginalResidenceRentClosingCaseMapper;
import com.ruoyi.project.data.cases.mapper.ResidenceRentAggregationCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceRentClosingCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.DownloadOtherResidenceRentClosingCaseMapper;
import com.ruoyi.project.data.cases.mapper.sync.SyncResidenceRentCaseMapper;
import com.ruoyi.project.data.cases.service.IOriginalResidenceRentClosingCaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -16,6 +19,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@ -39,6 +43,10 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private SyncResidenceRentCaseMapper syncResidenceRentCaseMapper;
@Autowired
private ResidenceRentAggregationCaseMapper residenceRentAggregationCaseMapper;
/**
*
@ -128,5 +136,20 @@ public class OriginalResidenceRentClosingCaseServiceImpl implements IOriginalRes
sql = rawSql.replace("#yearMonth#", yearMonth.toString())
.replace("#lastYearMonth#", lastYearMonth.toString());
jdbcTemplate.update(sql);
pushAggregateCase(yearMonth, lastYearMonth);
}
@Async
@Override
public void pushAggregateCase(Integer yearMonth, Integer currentPriceTableRoute) {
// 案例同步
syncResidenceRentCaseMapper.createAggregationCaseTable(currentPriceTableRoute);
List<CleanResidenceRentAggregationCase> list = residenceRentAggregationCaseMapper.getMonthly(yearMonth);
list.parallelStream().forEach(cleanResidenceRentAggregationCase -> {
cleanResidenceRentAggregationCase.setYearMonth(currentPriceTableRoute);
syncResidenceRentCaseMapper.insertAggregationCaseTable(cleanResidenceRentAggregationCase);
});
logger.info("推送案例汇总数据完成");
}
}

View File

@ -32,14 +32,16 @@ public class OriginalResidenceRentOpeningCaseServiceImpl implements IOriginalRes
private OriginalResidenceRentOpeningCaseMapper originalResidenceRentOpeningCaseMapper;
@Autowired
private DownloadOriginalResidenceRentOpeningCaseMapper downloadOriginalResidenceRentOpeningCaseMapper;
@Autowired
private DownloadOriginalResidenceRentPlatformCaseMapper downloadOriginalResidenceRentPlatformCaseMapper;
@Autowired
private SyncOriginalResidenceRentOpeningCaseMapper syncOriginalResidenceRentOpeningCaseMapper;
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private DownloadOriginalResidenceRentPlatformCaseMapper downloadOriginalResidenceRentPlatformCaseMapper;
/**
* 29号拉取挂牌案例
@ -136,6 +138,5 @@ public class OriginalResidenceRentOpeningCaseServiceImpl implements IOriginalRes
.replace("#lastYearMonth#", lastYearMonth.toString());
jdbcTemplate.update(sql);
logger.debug("#作价完成#");
}
}

View File

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

View File

@ -1,132 +0,0 @@
//package com.ruoyi.project.data.cases.service.impl;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.ruoyi.common.utils.LoadUtil;
//import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase;
//import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper;
//import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper;
//import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper;
//import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
//import org.springframework.jdbc.core.namedparam.SqlParameterSource;
//import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Service;
//
//import java.util.Calendar;
//import java.util.Date;
//import java.util.List;
//
//@Service
//@DS("compute")
//public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService {
//
// private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class);
//
// @Autowired
// private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper;
// @Autowired
// private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper;
// @Autowired
// private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper;
// @Autowired
// private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
// @Autowired
// private JdbcTemplate jdbcTemplate;
//
// /**
// *
// */
// @Scheduled(cron = "0 0 5 25 * ?")
// @Override
// public void clear() {
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(new Date());
// Integer syncTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
// calendar.get(Calendar.MONTH)));
// Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR),
// calendar.get(Calendar.MONTH) + 1));
// calendar.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));
//// computeTableRoute = 202007;
//// lastYearMonth = 202006;
//
// prepare(computeTableRoute, syncTableRoute);
// List<OriginalResidenceSaleOpeningCase> list = downloadOriginalResidenceSaleOpeningCaseMapper.download();
// list.parallelStream().forEach(originalResidenceOpeningCase -> {
//// originalResidenceOpeningCase.clear();
//// originalResidenceOpeningCase.setYearMonth(syncTableRoute);
//// syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase);
// });
// running(computeTableRoute, list);
// after(computeTableRoute, lastYearMonth);
// }
//
// /**
// * 准备工作 创建表
// *
// * @param computeTableRoute
// * @param syncTableRoute
// */
// public void prepare(Integer computeTableRoute, Integer syncTableRoute) {
// originalResidenceSaleOpeningCaseMapper.createRawTable(computeTableRoute);
// originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute);
// originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute);
// originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute);
// originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute);
// originalResidenceSaleOpeningCaseMapper.createUltimatePriceTable(computeTableRoute);
//// syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute);
// }
//
// /**
// * 批量入库
// *
// * @param computeTableRoute
// * @param list
// */
// public void running(Integer computeTableRoute, List<OriginalResidenceSaleOpeningCase> list) {
// SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray());
// int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" +
// ".ODS_HOUSINGCASELISTED_LJ_" + computeTableRoute + "_RAW(case_id, llid, lcid, Name, " +
// "Roomtype, Area, Towards, Storey, Lastdeal, Condoelev, Decoration, Year, Address, Price, " +
// "Cname, Visited_Num, First_Visit_Time, Visited_Num_15, Visited_Num_30, Url, Curl, CurlDate) " +
// "values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," +
// ":caseApartmentLayout,:caseArea,:caseToward,:caseStorey,:caseLastDeal,:caseElevator" +
// ",:caseDecoration,:caseYear,:caseAddress,:casePrice,:caseCommunityName,:caseVisitedNum," +
// ":caseFirstVisitTime,:caseVisitedNum15,:caseVisitedNum30,:caseUrl,:caseCommunityUrl," +
// ":caseGetDate);",
// batchParams);
// }
//
// /**
// * 匹配数据
// * 计算基价
// *
// * @param yearMonth
// * @param lastYearMonth
// */
// public void after(Integer yearMonth, Integer lastYearMonth) {
// // 清洗挂牌案例
//
// String rawSql = LoadUtil.loadContent("sql-template/clear_sale_opening_case.sql");
//// String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_opening_case.sql");
// String sql = rawSql.replace("#yearMonth#", yearMonth.toString())
// .replace("#lastYearMonth#", lastYearMonth.toString());
// jdbcTemplate.update(sql);
//
// // 作价
// rawSql = LoadUtil.loadContent("sql-template/compute_sale_price.sql");
// sql = rawSql.replace("#yearMonth#", yearMonth.toString())
// .replace("#lastYearMonth#", lastYearMonth.toString());
// jdbcTemplate.update(sql);
//
// logger.debug("#作价完成#");
// }
//}

View File

@ -94,7 +94,7 @@ public class ResidenceRentBasePriceController extends BaseController {
List<ComputeResidenceRentBasePrice> list =
computeResidenceRentPriceService.selectPageList(computeResidenceRentBasePrice);
ExcelUtil<ComputeResidenceRentBasePrice> util = new ExcelUtil<>(ComputeResidenceRentBasePrice.class);
return util.exportExcel(list, "住宅租赁基价初始化-" + computeResidenceRentBasePrice.getYearMonth());
return util.exportExcel(list, "住宅租赁基价初始化" + computeResidenceRentBasePrice.getYearMonth());
}

View File

@ -88,12 +88,14 @@ public class ResidenceSaleBasePriceController extends BaseController {
computeResidenceSaleBasePrice.setPageIndex(0);
computeResidenceSaleBasePrice.setPageSize(total);
List<ComputeResidenceSaleBasePrice> list = null;
if (0 == total)
if (0 == total) {
list = new LinkedList<>();
else
} else {
list = computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice);
}
ExcelUtil<ComputeResidenceSaleBasePrice> util = new ExcelUtil<>(ComputeResidenceSaleBasePrice.class);
return util.exportExcel(list, "住宅销售基价" + computeResidenceSaleBasePrice.getYearMonth());
return util.exportExcel(list, "住宅销售基价初始化" + computeResidenceSaleBasePrice.getYearMonth());
}
/**
@ -264,10 +266,12 @@ public class ResidenceSaleBasePriceController extends BaseController {
ultimateResidenceSaleBasePrice.setPageIndex(0);
ultimateResidenceSaleBasePrice.setPageSize(total);
List<UltimateResidenceSaleBasePrice> list = null;
if (0 == total)
if (0 == total) {
list = new LinkedList<>();
else
} else {
list = ultimateResidenceSalePriceService.selectList(ultimateResidenceSaleBasePrice);
}
ExcelUtil<UltimateResidenceSaleBasePrice> util = new ExcelUtil<>(UltimateResidenceSaleBasePrice.class);
return util.exportExcel(list, "住宅销售基价" + ultimateResidenceSaleBasePrice.getYearMonth());
}

View File

@ -73,15 +73,6 @@ public class UltimateOfficeBasePriceController extends BaseController {
return AjaxResult.success(officeBasePriceUltimateService.getById(yearMonth, id));
}
// /**
// * 修改办公基价
// */
// @PreAuthorize("@ss.hasPermi('system:user:edit')")
// @Log(title = "办公基价", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult update(@RequestBody UltimateOfficeBasePrice officeBasePriceUltimate) {
// return toAjax(officeBasePriceUltimateService.update(officeBasePriceUltimate));
// }
/**
* 导出办公基价列表

View File

@ -56,8 +56,6 @@ public class ArtificialResidenceRentPriceServiceImpl implements IArtificialResid
@Autowired
private SyncResidenceRentCaseMapper syncResidenceRentCaseMapper;
@Autowired
private ResidenceRentAggregationCaseMapper residenceRentAggregationCaseMapper;
@Autowired
private UltimateResidenceRentPriceMapper ultimateResidenceRentPriceMapper;
@Override
@ -217,14 +215,6 @@ public class ArtificialResidenceRentPriceServiceImpl implements IArtificialResid
@Async
public void pushData(Integer yearMonth, Integer currentPriceTableRoute, Integer lastPriceTableRoute) {
try {
// 案例同步
syncResidenceRentCaseMapper.createAggregationCaseTable(currentPriceTableRoute);
List<CleanResidenceRentAggregationCase> list = residenceRentAggregationCaseMapper.getMonthly(yearMonth);
list.parallelStream().forEach(cleanResidenceRentAggregationCase -> {
cleanResidenceRentAggregationCase.setYearMonth(currentPriceTableRoute);
syncResidenceRentCaseMapper.insertAggregationCaseTable(cleanResidenceRentAggregationCase);
});
// 当期价格同步
syncResidenceRentCaseMapper.createUltimatePriceTable(currentPriceTableRoute);
List<UltimateResidenceRentBasePrice> ultimateResidenceRentBasePrices =

View File

@ -11,6 +11,13 @@ ruoyi:
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 172.16.30.243:9200
index:
number-of-replicas: 0
number-of-shards: 3
# web服务器配置
server:

View File

@ -140,6 +140,7 @@
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="com.ruoyi" level="info"/>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="trace"/>
</springProfile>
<root level="info">

View File

@ -62,7 +62,7 @@
<result property="yearMonth" column="yearMonth"/>
</resultMap>
<!-- 汇总案例 -->
<select id="getOfficeAggregationCases" resultMap="AggregationCaseResultMapping">
<select id="getMonthly" resultMap="AggregationCaseResultMapping">
SELECT HouseholdsID_SRC
,ProjectID_SRC
,ProjectID

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.basis.mapper.UvClosingCaseMapper">
<resultMap id="ResultMapping" type="com.ruoyi.project.data.basis.domain.UvClosingCase">
<result property="dealId" column="ITEM_DEALID"/>
<result property="dealType" column="ITEM_DEALTYPE"/>
<result property="caseDistrict" column="ITEM_DISTRICT"/>
<result property="caseBlock" column="ITEM_SECTOR"/>
<result property="caseLoop" column="ITEM_CIRCLEPOSITION"/>
<result property="caseTotalPrice" column="ITEM_SUMPRICE"/>
<result property="caseUnitPrice" column="ITEM_UNITPRICE"/>
<result property="caseCommunityName" column="ITEM_RANAME"/>
<result property="caseAddress" column="ITEM_HOUSEADDRESS"/>
<result property="caseArea" column="ITEM_AREA" javaType="java.math.BigDecimal"/>
<result property="caseHouseType" column="ITEM_HOUSETYPE"/>
<result property="caseHouseProperty" column="ITEM_ROOMNATURE"/>
<result property="caseContractDate" column="ITEM_SIGNINGDATA" javaType="java.sql.Date" />
<result property="caseFloor" column="ITEM_FLOOR"/>
<result property="caseApartmentLayout" column="ITEM_APARTMENT"/>
<result property="propertyType" column="ITEM_PROPERTYTYPE"/>
<result property="communityId" column="ITEM_AIRAID"/>
<result property="communityName" column="ITEM_STANDARDRA"/>
<result property="buildingId" column="ITEM_AIUNITID"/>
<result property="buildingName" column="ITEM_STANDARDUNITADDRESS"/>
<result property="condoId" column="ITEM_SINGLEID"/>
<result property="condoName" column="ITEM_STANDARDSINGLEADDRESS"/>
</resultMap>
<!-- 获取爬虫库中的办公案例 -->
<select id="selectPageList" resultMap="ResultMapping" parameterType="com.ruoyi.project.data.basis.domain.UvClosingCase">
select ITEM_AIRAID,ITEM_AIUNITID,ITEM_APARTMENT,ITEM_AREA,ITEM_CIRCLEPOSITION,ITEM_DEALID,ITEM_DEALTYPE,ITEM_DISTRICT,ITEM_FLOOR,ITEM_HOUSEADDRESS,ITEM_HOUSETYPE,ITEM_PROPERTYTYPE,ITEM_RANAME,ITEM_ROOMNATURE,ITEM_SECTOR,ITEM_SIGNINGDATA,ITEM_SINGLEID,ITEM_STANDARDRA,ITEM_STANDARDSINGLEADDRESS,ITEM_STANDARDUNITADDRESS,ITEM_SUMPRICE,ITEM_UNITPRICE
from dbo.TLK_成交案例
<where>
<if test="dealId != null">
ITEM_DEALID=#{dealId}
</if>
</where>
order by ITEM_DEALID ASC offset #{offset} rows fetch next #{limit} rows only
</select>
<select id="selectPageCount" resultType="int" parameterType="com.ruoyi.project.data.basis.domain.UvClosingCase">
select count(1)
from dbo.TLK_成交案例
<where>
<if test="dealId != null">
ITEM_DEALID=#{dealId}
</if>
</where>
</select>
</mapper>

View File

@ -15,6 +15,15 @@ import java.util.stream.Stream;
public class GenerateTableTests {
@Test
public void testFileName() {
String fileName = "中文_12312312-zxcjdf9021.xlsx";
String realFileName =
fileName.substring(0, fileName.indexOf("_")) + fileName.substring(fileName.lastIndexOf(
"."));
Assert.assertEquals("中文.xlsx", realFileName);
}
@Test
public void testLastYearMonth() {
@ -235,7 +244,6 @@ public class GenerateTableTests {
}
/**
*
*/
@ -292,8 +300,8 @@ public class GenerateTableTests {
list.forEach(x -> {
int index = x.indexOf("大道");
if(-1 != index) {
System.out.println(x.substring(0,index+2));
if (-1 != index) {
System.out.println(x.substring(0, index + 2));
}
});

View File

@ -36,4 +36,8 @@ public class ResidenceRentBasePriceTests {
originalResidenceRentClosingCaseService.pullData();
}
@Test
public void testPushAggregateCase() {
originalResidenceRentClosingCaseService.pushAggregateCase(202008, 202007);
}
}