From 0d14af53acb51647ca9ea3ad9fa45b201f1bf37a Mon Sep 17 00:00:00 2001 From: purple Date: Wed, 17 Jun 2020 18:39:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=AF=8F=E6=9C=88=E4=BD=9C=E4=BB=B7)?= =?UTF-8?q?=EF=BC=9A=E4=BC=98=E5=8C=96=E4=BD=8F=E5=AE=85=E5=94=AE=E4=BB=B7?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 成交案例下载和清洗 2. 挂牌案例下载、上传、清洗 3. 编写单元测试 --- ruoyi-ui/src/api/data/basePrice.js | 36 + .../api/data/originalResidenceOpeningCase.js | 36 + .../cases/OriginalResidenceOpeningCase.vue | 150 ++++ ruoyi-ui/src/views/data/price/BasePrice.vue | 464 ++++++++++ .../java/com/ruoyi/common/utils/LoadUtil.java | 143 +++ .../data/basis/domain/UVBasePrice.java | 99 +++ .../basis/domain/UVBasePriceQueryModel.java | 22 + .../data/basis/mapper/UVBasePriceMapper.java | 24 + .../basis/service/IUVBasePriceService.java | 26 + .../service/impl/UVBasePriceServiceImpl.java | 69 ++ .../cases/controller/CasesController.java | 1 - .../OriginalResidenceSaleClosingCase.java | 819 ++++++++++++++++++ .../OriginalResidenceSaleOpeningCase.java | 803 +++++++++++++++++ ...nalResidenceSaleOpeningCaseQueryModel.java | 23 + ...riginalResidenceSaleClosingCaseMapper.java | 41 + ...riginalResidenceSaleOpeningCaseMapper.java | 50 ++ ...riginalResidenceSaleClosingCaseMapper.java | 17 + ...riginalResidenceSaleOpeningCaseMapper.java | 15 + ...riginalResidenceSaleOpeningCaseMapper.java | 23 + ...iginalResidenceSaleClosingCaseService.java | 5 + ...iginalResidenceSaleOpeningCaseService.java | 5 + ...alResidenceSaleClosingCaseServiceImpl.java | 109 +++ ...alResidenceSaleOpeningCaseServiceImpl.java | 122 +++ .../price/controller/BasePriceController.java | 36 + ...mputeResidenceSaleBasePriceController.java | 13 + ...OriginalResidenceSaleClosingCaseMapper.xml | 47 + ...OriginalResidenceSaleOpeningCaseMapper.xml | 59 ++ ...OriginalResidenceSaleClosingCaseMapper.xml | 74 ++ ...OriginalResidenceSaleOpeningCaseMapper.xml | 168 ++++ ...SyncOriginalResidenceOpeningCaseMapper.xml | 87 ++ .../mybatis/data/UVBasePriceMapper.xml | 57 ++ .../sql-template/clear_closing_case.sql | 89 ++ .../sql-template/clear_opening_case.sql | 499 +++++++++++ .../compute/MapperXmlGeneratorTests.java | 9 + .../compute/ResidenceSaleBasePriceTests.java | 32 + 35 files changed, 4271 insertions(+), 1 deletion(-) create mode 100644 ruoyi-ui/src/api/data/basePrice.js create mode 100644 ruoyi-ui/src/api/data/originalResidenceOpeningCase.js create mode 100644 ruoyi-ui/src/views/data/cases/OriginalResidenceOpeningCase.vue create mode 100644 ruoyi-ui/src/views/data/price/BasePrice.vue create mode 100644 ruoyi/src/main/java/com/ruoyi/common/utils/LoadUtil.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePrice.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePriceQueryModel.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/basis/mapper/UVBasePriceMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/basis/service/IUVBasePriceService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/basis/service/impl/UVBasePriceServiceImpl.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleClosingCase.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCase.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCaseQueryModel.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleClosingCaseMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleOpeningCaseMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleClosingCaseMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleOpeningCaseMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/SyncOriginalResidenceSaleOpeningCaseMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleClosingCaseService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleOpeningCaseService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleClosingCaseServiceImpl.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleOpeningCaseServiceImpl.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/data/price/controller/BasePriceController.java create mode 100644 ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleClosingCaseMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleOpeningCaseMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleClosingCaseMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleOpeningCaseMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/data/SyncOriginalResidenceOpeningCaseMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/data/UVBasePriceMapper.xml create mode 100644 ruoyi/src/main/resources/sql-template/clear_closing_case.sql create mode 100644 ruoyi/src/main/resources/sql-template/clear_opening_case.sql create mode 100644 ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java diff --git a/ruoyi-ui/src/api/data/basePrice.js b/ruoyi-ui/src/api/data/basePrice.js new file mode 100644 index 000000000..c551cf298 --- /dev/null +++ b/ruoyi-ui/src/api/data/basePrice.js @@ -0,0 +1,36 @@ +import request from '@/utils/request' + +// 查询最终住宅租赁基价列表 +export function list(query) { + return request({ + url: '/data/base/price/list', + method: 'get', + params: query + }) +} + +// 查询最终住宅租赁基价详细 +export function get(id) { + return request({ + url: '/data/base/price/' + id, + method: 'get' + }) +} + +// 修改最终住宅租赁基价 +export function update(data) { + return request({ + url: '/data/base/price', + method: 'put', + data: data + }) +} + +// 导出最终住宅租赁基价 +export function export2File(query) { + return request({ + url: '/data/base/price/export', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/api/data/originalResidenceOpeningCase.js b/ruoyi-ui/src/api/data/originalResidenceOpeningCase.js new file mode 100644 index 000000000..c551cf298 --- /dev/null +++ b/ruoyi-ui/src/api/data/originalResidenceOpeningCase.js @@ -0,0 +1,36 @@ +import request from '@/utils/request' + +// 查询最终住宅租赁基价列表 +export function list(query) { + return request({ + url: '/data/base/price/list', + method: 'get', + params: query + }) +} + +// 查询最终住宅租赁基价详细 +export function get(id) { + return request({ + url: '/data/base/price/' + id, + method: 'get' + }) +} + +// 修改最终住宅租赁基价 +export function update(data) { + return request({ + url: '/data/base/price', + method: 'put', + data: data + }) +} + +// 导出最终住宅租赁基价 +export function export2File(query) { + return request({ + url: '/data/base/price/export', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/data/cases/OriginalResidenceOpeningCase.vue b/ruoyi-ui/src/views/data/cases/OriginalResidenceOpeningCase.vue new file mode 100644 index 000000000..8f08d8516 --- /dev/null +++ b/ruoyi-ui/src/views/data/cases/OriginalResidenceOpeningCase.vue @@ -0,0 +1,150 @@ + + + + diff --git a/ruoyi-ui/src/views/data/price/BasePrice.vue b/ruoyi-ui/src/views/data/price/BasePrice.vue new file mode 100644 index 000000000..4345a2307 --- /dev/null +++ b/ruoyi-ui/src/views/data/price/BasePrice.vue @@ -0,0 +1,464 @@ + + + diff --git a/ruoyi/src/main/java/com/ruoyi/common/utils/LoadUtil.java b/ruoyi/src/main/java/com/ruoyi/common/utils/LoadUtil.java new file mode 100644 index 000000000..fbf1a8336 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/common/utils/LoadUtil.java @@ -0,0 +1,143 @@ +package com.ruoyi.common.utils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class LoadUtil { + private static final int SIZE = 1024; + private static final String CHARSET_NAME = "UTF-8"; + + public static String loadContent(String name) { + + InputStream is = null; + try { + is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); + StringBuffer stringBuffer = new StringBuffer(); + BufferedReader reader = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE); + char[] buf = new char[1024]; + int numRead = 0; + while ((numRead = reader.read(buf)) != -1) { + String readData = String.valueOf(buf, 0, numRead); + stringBuffer.append(readData); + buf = new char[1024]; + } + reader.close(); + return stringBuffer.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + return null; + } + + /** + * @param name + * @return + */ + public static List loadList(String name) { + List result = new ArrayList<>(); + InputStream is = null; + try { + is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); + BufferedReader br = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE); + String theWord = null; + do { + try { + theWord = br.readLine(); + if (null != theWord) + result.add(theWord); + } catch (IOException e) { + e.printStackTrace(); + } + + } while (theWord != null); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + + return result; + } +// 这样写有什么问题吗? +// private static BufferedReader readLine(String name) { +// InputStream is = null; +// try { +// is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); +// BufferedReader br = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE); +// return br; +// } catch (IOException e) { +// e.printStackTrace(); +// } finally { +// try { +// if (is != null) { +// is.close(); +// } +// } catch (IOException e) { +// e.printStackTrace(); +// } +// +// } +// return null; +// } + + /** + * @param name + * @return + */ + public static Map loadDict(String name) { + Map result = new LinkedHashMap<>(); + InputStream is = null; + try { + is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); + BufferedReader br = new BufferedReader(new InputStreamReader(is, CHARSET_NAME), SIZE); + String theWord = null; + do { + try { + theWord = br.readLine(); + if (null != theWord) { + String[] pair = theWord.split(" "); + result.put(pair[0], pair[1]); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } while (theWord != null); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + + return result; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePrice.java b/ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePrice.java new file mode 100644 index 000000000..425bf0e06 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePrice.java @@ -0,0 +1,99 @@ +package com.ruoyi.project.data.basis.domain; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.framework.web.domain.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + +public class UVBasePrice extends BaseEntity { + /** + * 小区id + */ + private String communityId; + /** + * 价格类型 + */ + private Integer priceType; + + /** + * 小区类型(1、住宅;2、办公) + */ + private Integer communityType; + + /** + * 基价(售价、租金) + */ + private BigDecimal standardPrice; + /** + * 主力面积基价(售价、租金) + */ + private BigDecimal mainAreaPrice; + /** + * 价值时点 + */ + @JsonFormat(pattern="yyyy-MM-dd") + private Date valuePoint; + /** + * 修改说明 + */ + private String comment; + + public String getCommunityId() { + return communityId; + } + + public void setCommunityId(String communityId) { + this.communityId = communityId; + } + + public Integer getPriceType() { + return priceType; + } + + public void setPriceType(Integer priceType) { + this.priceType = priceType; + } + + public Integer getCommunityType() { + return communityType; + } + + public void setCommunityType(Integer communityType) { + this.communityType = communityType; + } + + public BigDecimal getStandardPrice() { + return standardPrice; + } + + public void setStandardPrice(BigDecimal standardPrice) { + this.standardPrice = standardPrice; + } + + public BigDecimal getMainAreaPrice() { + return mainAreaPrice; + } + + public void setMainAreaPrice(BigDecimal mainAreaPrice) { + this.mainAreaPrice = mainAreaPrice; + } + + public Date getValuePoint() { + return valuePoint; + } + + public void setValuePoint(Date valuePoint) { + this.valuePoint = valuePoint; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePriceQueryModel.java b/ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePriceQueryModel.java new file mode 100644 index 000000000..86ccc18f5 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/basis/domain/UVBasePriceQueryModel.java @@ -0,0 +1,22 @@ +package com.ruoyi.project.data.basis.domain; + +public class UVBasePriceQueryModel extends UVBasePrice { + private Integer pageIndex; + private Integer pageSize; + + public Integer getPageIndex() { + return pageIndex; + } + + public void setPageIndex(Integer pageIndex) { + this.pageIndex = pageIndex; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/basis/mapper/UVBasePriceMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/basis/mapper/UVBasePriceMapper.java new file mode 100644 index 000000000..2a789b3bc --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/basis/mapper/UVBasePriceMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.project.data.basis.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.data.basis.domain.UVBasePrice; +import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel; + +import java.util.List; + +@DS("teemlink") +public interface UVBasePriceMapper { + /** + * 分页总数 + * + * @param uvBasePrice + * @return + */ + Integer pageCount(UVBasePrice uvBasePrice); + + /** + * @param queryModel + * @return + */ + List pageList(UVBasePriceQueryModel queryModel); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/basis/service/IUVBasePriceService.java b/ruoyi/src/main/java/com/ruoyi/project/data/basis/service/IUVBasePriceService.java new file mode 100644 index 000000000..a69f6fe04 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/basis/service/IUVBasePriceService.java @@ -0,0 +1,26 @@ +package com.ruoyi.project.data.basis.service; + +import com.ruoyi.project.data.basis.domain.UVBasePrice; +import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel; + +import java.util.List; + +public interface IUVBasePriceService{ + + /** + * 分页查询 + * + * @param queryModel + * @return + */ + List pageList(UVBasePriceQueryModel queryModel); + + /** + * + * @param queryModel + * @return + */ + Integer pageCount(UVBasePriceQueryModel queryModel); + + +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/basis/service/impl/UVBasePriceServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/data/basis/service/impl/UVBasePriceServiceImpl.java new file mode 100644 index 000000000..23720b717 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/basis/service/impl/UVBasePriceServiceImpl.java @@ -0,0 +1,69 @@ +package com.ruoyi.project.data.basis.service.impl; + +import com.ruoyi.project.data.basis.domain.LianJiaCommunityDict; +import com.ruoyi.project.data.basis.domain.UVBasePrice; +import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel; +import com.ruoyi.project.data.basis.mapper.LianJiaCommunityDictMapper; +import com.ruoyi.project.data.basis.mapper.UVBasePriceMapper; +import com.ruoyi.project.data.basis.service.ILianJiaCommunityDictService; +import com.ruoyi.project.data.basis.service.IUVBasePriceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class UVBasePriceServiceImpl implements IUVBasePriceService { + + @Autowired + private UVBasePriceMapper uvBasePriceMapper; + +// @Override +// public int insert(LianJiaCommunityDict dict) { +// return jdbcTemplate.update("insert into [dbo].[lianjia_dictionary]([lianjia_community_id]," + +// "[lianjia_community_name]," + +// "[lianjia_community_address],[lianjia_community_url],[lianjia_community_curl],[community_id]," + +// "[building_id],[clean_community_name],[clean_community_address],[clean_building_address],[enable]," + +// "[create_time]) value (?,?,?,?,?,?,?,?,?,?,1,getdate());", new Object[]{dict.getLianJiaCommunityId(), +// dict.getLianJiaCommunityName(), dict.getLianJiaCommunityAddress(), dict.getLianJiaUrl(), +// dict.getLianJiaCommunityUrl(), dict.getCommunityId(), dict.getBuildingId(), dict +// .getCleanCommunityName() +// , dict.getCleanCommunityAddress(), dict.getCleanBuildingAddress()}); +// } +// +// @Override +// public int update(LianJiaCommunityDict dict) { +// return 0; +// } +// +// @Override +// public int delete(Integer id) { +// return jdbcTemplate.update("delete from lianjia_dictionary where id= ? ;", new Object[]{id}); +// } +// +// @Override +// public List selectPageOfList(LianJiaCommunityDict dict) { +// return lianJiaCommunityDictMapper.selectPageOfList(dict); +// } +// +// @Override +// public int selectPageOfTotal(LianJiaCommunityDict dict) { +// return lianJiaCommunityDictMapper.selectPageOfTotal(dict); +// } +// +// @Override +// public LianJiaCommunityDict selectById(Integer id) { +// return lianJiaCommunityDictMapper.selectById(id); +// } + + @Override + public List pageList(UVBasePriceQueryModel queryModel) { + return uvBasePriceMapper.pageList(queryModel); + } + + @Override + public Integer pageCount(UVBasePriceQueryModel queryModel) { + return uvBasePriceMapper.pageCount(queryModel); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/controller/CasesController.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/controller/CasesController.java index 8d2ce9b4f..ee03b6b09 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/data/cases/controller/CasesController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/controller/CasesController.java @@ -28,5 +28,4 @@ public class CasesController { } - } diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleClosingCase.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleClosingCase.java new file mode 100644 index 000000000..cd434b388 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleClosingCase.java @@ -0,0 +1,819 @@ +package com.ruoyi.project.data.cases.domain; + +import com.ruoyi.common.utils.StringUtils; +import org.springframework.util.DigestUtils; + +import java.math.BigDecimal; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 住宅成交案例 + */ +public class OriginalResidenceSaleClosingCase { + private static final SimpleDateFormat simplaDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + private static List juzhu = new LinkedList<>(); + private static List bangong = new LinkedList<>(); + private static List shangye = new LinkedList<>(); + + static { + juzhu.add("办公楼"); + juzhu.add("商铺"); + juzhu.add("未知"); + juzhu.add("其它"); + juzhu.add("工厂"); + juzhu.add("车库"); + + bangong.add("办公"); + bangong.add("办公楼"); + bangong.add("写字楼"); + + shangye.add("商铺"); + shangye.add("商店"); + } + + /** + * 唯一标识 + */ + private String caseId; + /** + * 小区名称 + */ + private String caseCommunityName; + /** + * 房屋地址 + */ + private String caseAddress; + /** + * 区域 + */ + private String caseCountyName; + private String cleanCountyName; + /** + * 板块 + */ + private String caseBlockName; + private String cleanBlockName; + /** + * 环线 + */ + private String caseLoopName; + private String cleanLoopName; + /** + * 合同编号 + */ + private String caseContractNumber; + /** + * 房源编号 + */ + private String caseNumber; + /** + * 户型 + */ + private String caseApartmentLayout; + /** + * 面积 + */ + private BigDecimal caseArea; + /** + * 朝向 + */ + private String caseToward; + /** + * 楼层 + */ + private String caseStorey; + /** + * 总楼层 + */ + private String cleanTotalFloor; + /** + * 地上层数 + */ + private Integer cleanGroundFloor; + /** + * 所在层 + */ + private Integer cleanCurrentFloor; + /** + * 所在楼层描述 + */ + private String cleanCurrentFloorDesc; + /** + * 登记日期 + */ + private Date caseRegisterDate; + /** + * 签约日期 + */ + private Date caseSigningDate; + /** + * 挂牌价格 + */ + private BigDecimal caseOpeningPrice; + /** + * 成交总价 + */ + private BigDecimal caseTotalPrice; + /** + * 成交单价 + */ + private BigDecimal caseUnitPrice; + /** + * 抓取日期 + */ + private Date caseGetDate; + /** + * 成交URL + */ + private String caseUrl; + /** + * 中介公司 + */ + private String agencyName; + /** + * 中介类型 + */ + private String agencyType; + /** + * 卖家类型 + */ + private String sellerType; + /** + * 买家类型 + */ + private String buyerType; + /** + * 出生年月日 + */ + private Date birthday; + /** + * 抓取网站名 + */ + private String caseProvider; + /** + * 房屋类型(公寓 口径后面提供) + */ + private String caseHouseType; + /** + * 成交类型 必填 二手 取值:一手、二手 + */ + private Integer cleanCaseType; + /** + * 单套地址 + */ + private String cleanCondoAddress; + /** + * 楼栋地址 + */ + private String cleanBuildingAddress; + /** + * 房屋地址(一手二手)(规范) 浦城路366弄8号1803 地址匹配中间结果 + * 应该是单套地址 + */ + private String cleanAddress; + /** + * 单套id + */ + private String cleanCondoId; + /** + * 楼栋id + */ + private String cleanBuildingId; + /** + * 小区id + */ + private String cleanCommunityId; + /** + * 楼栋系数 + */ + private BigDecimal buildingCoefficient; + /** + * 单套系数 + */ + private BigDecimal condoAreaCoefficient; + /** + * 竣工日期 + */ + private Integer caseYear; + /** + * 年份系数 + */ + private BigDecimal yearCoefficient; + /** + * 主力面积基价 + */ + private BigDecimal areaCoefficient; + /** + * 物业档次 + */ + private String cleanProjectLevel; + /** + * 电梯 + */ + private String caseElevator; + private Boolean cleanElevator; + /** + * 电梯系数 + */ + private Integer elevatorCoefficient; + /** + * 没有电梯系数 + */ + private Integer noElevatorCoefficient; + /** + * 楼层修正系数 + */ + private BigDecimal floorCoefficient; + /*** + * 评估单价 + */ + private BigDecimal appraiseUnitPrice; + /** + * 评估总价 + */ + private BigDecimal appraiseTotalPrice; + + /** + * 物业类型 + */ + private String cleanPropertyType; + /** + * 房屋性质 + */ + private String caseHouseProperty; + /** + * 计算总价 + */ + private BigDecimal computeTotalPrice; + /** + * 计算单价 + */ + private BigDecimal computeUnitPrice; + /** + * 参考总价 + */ + private BigDecimal refTotalPrice; + /** + * 参考单价 + */ + private BigDecimal refUnitPrice; + + public String getCaseId() { + return caseId; + } + + public void setCaseId(String caseId) { + this.caseId = caseId; + } + + public String getCaseCommunityName() { + return caseCommunityName; + } + + public void setCaseCommunityName(String caseCommunityName) { + this.caseCommunityName = caseCommunityName; + } + + public String getCaseAddress() { + return caseAddress; + } + + public void setCaseAddress(String caseAddress) { + this.caseAddress = caseAddress; + } + + public String getCaseCountyName() { + return caseCountyName; + } + + public void setCaseCountyName(String caseCountyName) { + this.caseCountyName = caseCountyName; + } + + public String getCleanCountyName() { + return cleanCountyName; + } + + public void setCleanCountyName(String cleanCountyName) { + this.cleanCountyName = cleanCountyName; + } + + public String getCaseBlockName() { + return caseBlockName; + } + + public void setCaseBlockName(String caseBlockName) { + this.caseBlockName = caseBlockName; + } + + public String getCleanBlockName() { + return cleanBlockName; + } + + public void setCleanBlockName(String cleanBlockName) { + this.cleanBlockName = cleanBlockName; + } + + public String getCaseLoopName() { + return caseLoopName; + } + + public void setCaseLoopName(String caseLoopName) { + this.caseLoopName = caseLoopName; + } + + public String getCleanLoopName() { + return cleanLoopName; + } + + public void setCleanLoopName(String cleanLoopName) { + this.cleanLoopName = cleanLoopName; + } + + public String getCaseContractNumber() { + return caseContractNumber; + } + + public void setCaseContractNumber(String caseContractNumber) { + this.caseContractNumber = caseContractNumber; + } + + public String getCaseNumber() { + return caseNumber; + } + + public void setCaseNumber(String caseNumber) { + this.caseNumber = caseNumber; + } + + public String getCaseApartmentLayout() { + return caseApartmentLayout; + } + + public void setCaseApartmentLayout(String caseApartmentLayout) { + this.caseApartmentLayout = caseApartmentLayout; + } + + public BigDecimal getCaseArea() { + return caseArea; + } + + public void setCaseArea(BigDecimal caseArea) { + this.caseArea = caseArea; + } + + public String getCaseToward() { + return caseToward; + } + + public void setCaseToward(String caseToward) { + this.caseToward = caseToward; + } + + public String getCaseStorey() { + return caseStorey; + } + + public void setCaseStorey(String caseStorey) { + this.caseStorey = caseStorey; + } + + public String getCleanTotalFloor() { + return cleanTotalFloor; + } + + public void setCleanTotalFloor(String cleanTotalFloor) { + this.cleanTotalFloor = cleanTotalFloor; + } + + public Integer getCleanGroundFloor() { + return cleanGroundFloor; + } + + public void setCleanGroundFloor(Integer cleanGroundFloor) { + this.cleanGroundFloor = cleanGroundFloor; + } + + public Integer getCleanCurrentFloor() { + return cleanCurrentFloor; + } + + public void setCleanCurrentFloor(Integer cleanCurrentFloor) { + this.cleanCurrentFloor = cleanCurrentFloor; + } + + public Date getCaseRegisterDate() { + return caseRegisterDate; + } + + public void setCaseRegisterDate(Date caseRegisterDate) { + this.caseRegisterDate = caseRegisterDate; + } + + public Date getCaseSigningDate() { + return caseSigningDate; + } + + public void setCaseSigningDate(Date caseSigningDate) { + this.caseSigningDate = caseSigningDate; + } + + public BigDecimal getCaseOpeningPrice() { + return caseOpeningPrice; + } + + public void setCaseOpeningPrice(BigDecimal caseOpeningPrice) { + this.caseOpeningPrice = caseOpeningPrice; + } + + public BigDecimal getCaseTotalPrice() { + return caseTotalPrice; + } + + public void setCaseTotalPrice(BigDecimal caseTotalPrice) { + this.caseTotalPrice = caseTotalPrice; + } + + public BigDecimal getCaseUnitPrice() { + return caseUnitPrice; + } + + public void setCaseUnitPrice(BigDecimal caseUnitPrice) { + this.caseUnitPrice = caseUnitPrice; + } + + public Date getCaseGetDate() { + return caseGetDate; + } + + public void setCaseGetDate(Date caseGetDate) { + this.caseGetDate = caseGetDate; + } + + public String getCaseUrl() { + return caseUrl; + } + + public void setCaseUrl(String caseUrl) { + this.caseUrl = caseUrl; + } + + public String getAgencyName() { + return agencyName; + } + + public void setAgencyName(String agencyName) { + this.agencyName = agencyName; + } + + public String getAgencyType() { + return agencyType; + } + + public void setAgencyType(String agencyType) { + this.agencyType = agencyType; + } + + public String getSellerType() { + return sellerType; + } + + public void setSellerType(String sellerType) { + this.sellerType = sellerType; + } + + public String getBuyerType() { + return buyerType; + } + + public void setBuyerType(String buyerType) { + this.buyerType = buyerType; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public String getCaseProvider() { + return caseProvider; + } + + public void setCaseProvider(String caseProvider) { + this.caseProvider = caseProvider; + } + + public String getCaseHouseType() { + return caseHouseType; + } + + public void setCaseHouseType(String caseHouseType) { + this.caseHouseType = caseHouseType; + } + + public Integer getCleanCaseType() { + return cleanCaseType; + } + + public void setCleanCaseType(Integer cleanCaseType) { + this.cleanCaseType = cleanCaseType; + } + + public String getCleanCondoAddress() { + return cleanCondoAddress; + } + + public void setCleanCondoAddress(String cleanCondoAddress) { + this.cleanCondoAddress = cleanCondoAddress; + } + + public String getCleanBuildingAddress() { + return cleanBuildingAddress; + } + + public void setCleanBuildingAddress(String cleanBuildingAddress) { + this.cleanBuildingAddress = cleanBuildingAddress; + } + + public String getCleanAddress() { + return cleanAddress; + } + + public void setCleanAddress(String cleanAddress) { + this.cleanAddress = cleanAddress; + } + + public String getCleanCondoId() { + return cleanCondoId; + } + + public void setCleanCondoId(String cleanCondoId) { + this.cleanCondoId = cleanCondoId; + } + + public String getCleanBuildingId() { + return cleanBuildingId; + } + + public void setCleanBuildingId(String cleanBuildingId) { + this.cleanBuildingId = cleanBuildingId; + } + + public String getCleanCommunityId() { + return cleanCommunityId; + } + + public void setCleanCommunityId(String cleanCommunityId) { + this.cleanCommunityId = cleanCommunityId; + } + + public BigDecimal getBuildingCoefficient() { + return buildingCoefficient; + } + + public void setBuildingCoefficient(BigDecimal buildingCoefficient) { + this.buildingCoefficient = buildingCoefficient; + } + + public BigDecimal getCondoAreaCoefficient() { + return condoAreaCoefficient; + } + + public void setCondoAreaCoefficient(BigDecimal condoAreaCoefficient) { + this.condoAreaCoefficient = condoAreaCoefficient; + } + + public Integer getCaseYear() { + return caseYear; + } + + public void setCaseYear(Integer caseYear) { + this.caseYear = caseYear; + } + + public BigDecimal getYearCoefficient() { + return yearCoefficient; + } + + public void setYearCoefficient(BigDecimal yearCoefficient) { + this.yearCoefficient = yearCoefficient; + } + + public BigDecimal getAreaCoefficient() { + return areaCoefficient; + } + + public void setAreaCoefficient(BigDecimal areaCoefficient) { + this.areaCoefficient = areaCoefficient; + } + + public String getCleanProjectLevel() { + return cleanProjectLevel; + } + + public void setCleanProjectLevel(String cleanProjectLevel) { + this.cleanProjectLevel = cleanProjectLevel; + } + + public String getCaseElevator() { + return caseElevator; + } + + public void setCaseElevator(String caseElevator) { + this.caseElevator = caseElevator; + } + + public Boolean getCleanElevator() { + return cleanElevator; + } + + public void setCleanElevator(Boolean cleanElevator) { + this.cleanElevator = cleanElevator; + } + + public Integer getElevatorCoefficient() { + return elevatorCoefficient; + } + + public void setElevatorCoefficient(Integer elevatorCoefficient) { + this.elevatorCoefficient = elevatorCoefficient; + } + + public Integer getNoElevatorCoefficient() { + return noElevatorCoefficient; + } + + public void setNoElevatorCoefficient(Integer noElevatorCoefficient) { + this.noElevatorCoefficient = noElevatorCoefficient; + } + + public BigDecimal getFloorCoefficient() { + return floorCoefficient; + } + + public void setFloorCoefficient(BigDecimal floorCoefficient) { + this.floorCoefficient = floorCoefficient; + } + + public BigDecimal getAppraiseUnitPrice() { + return appraiseUnitPrice; + } + + public void setAppraiseUnitPrice(BigDecimal appraiseUnitPrice) { + this.appraiseUnitPrice = appraiseUnitPrice; + } + + public BigDecimal getAppraiseTotalPrice() { + return appraiseTotalPrice; + } + + public void setAppraiseTotalPrice(BigDecimal appraiseTotalPrice) { + this.appraiseTotalPrice = appraiseTotalPrice; + } + + public String getCleanPropertyType() { + return cleanPropertyType; + } + + public void setCleanPropertyType(String cleanPropertyType) { + this.cleanPropertyType = cleanPropertyType; + } + + public String getCaseHouseProperty() { + return caseHouseProperty; + } + + public void setCaseHouseProperty(String caseHouseProperty) { + this.caseHouseProperty = caseHouseProperty; + } + + public BigDecimal getComputeTotalPrice() { + return computeTotalPrice; + } + + public void setComputeTotalPrice(BigDecimal computeTotalPrice) { + this.computeTotalPrice = computeTotalPrice; + } + + public BigDecimal getComputeUnitPrice() { + return computeUnitPrice; + } + + public void setComputeUnitPrice(BigDecimal computeUnitPrice) { + this.computeUnitPrice = computeUnitPrice; + } + + public BigDecimal getRefTotalPrice() { + return refTotalPrice; + } + + public void setRefTotalPrice(BigDecimal refTotalPrice) { + this.refTotalPrice = refTotalPrice; + } + + public BigDecimal getRefUnitPrice() { + return refUnitPrice; + } + + public void setRefUnitPrice(BigDecimal refUnitPrice) { + this.refUnitPrice = refUnitPrice; + } + + public String getCleanCurrentFloorDesc() { + return cleanCurrentFloorDesc; + } + + public void setCleanCurrentFloorDesc(String cleanCurrentFloorDesc) { + this.cleanCurrentFloorDesc = cleanCurrentFloorDesc; + } + + /** + * 构造caseId + * + * @return + * @throws NoSuchAlgorithmException + */ + public String generateCaseId() { + String text = getCaseCountyName() + getCaseAddress() + getCaseArea(); + if (null != getCaseSigningDate()) + text += simplaDateFormat.format(getCaseSigningDate()); + + return DigestUtils.md5DigestAsHex(text.getBytes()); + } + + + public String refinePropertyType() { + String houseType = getCaseHouseType(); + if (StringUtils.isEmpty(houseType)) return "其他"; + + // 不包含 + boolean exists = juzhu.stream().filter(x -> x.equals(houseType)).findAny().isPresent(); + if (!exists) + return "居住"; + + exists = bangong.stream().filter(x -> x.equals(houseType)).findAny().isPresent(); + if (!exists) + return "办公"; + + exists = shangye.stream().filter(x -> x.equals(houseType)).findAny().isPresent(); + if (!exists) + return "商业"; + + return "其他"; + } + + /** + * 从室号中提取所在层 + * + * @return + */ + public Integer refineCurrentFloor() { + if (StringUtils.isEmpty(getCaseAddress())) return null; + + Pattern pattern = Pattern.compile("(\\d+)(室)$"); + + Matcher matcher = pattern.matcher(getCaseAddress()); + if (!matcher.find()) return null; + + String value = matcher.group(1); + Integer num = new Integer(value); + if (num > 1000 || num > 100) + return num / 100; + + return null; + } + + /** + * 获取楼栋地址 + * 1. 去掉abc室 + * 2. 去掉末尾是数字的 + * + * @return + */ + public String refineBuildingAddress() { + if (StringUtils.isEmpty(getCaseAddress())) return null; + + Pattern pattern = Pattern.compile("(\\d+)室$"); + Matcher matcher = pattern.matcher(getCaseAddress()); + if (matcher.find()) { + return getCaseAddress().replace(matcher.group(0), ""); + } + + pattern = Pattern.compile("(\\d+)$"); + matcher = pattern.matcher(getCaseAddress()); + if (matcher.find()) { + return getCaseAddress().replace(matcher.group(0), ""); + } + + return null; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCase.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCase.java new file mode 100644 index 000000000..529e2bea3 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCase.java @@ -0,0 +1,803 @@ +package com.ruoyi.project.data.cases.domain; + +import com.ruoyi.common.utils.StringUtils; +import org.springframework.util.DigestUtils; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class OriginalResidenceSaleOpeningCase { + + // 东南, 西南, 西北, 东北, 南, 东, 西, 北 + private static String[] towardArray = new String[]{"东南", "西南", "西北", "东北", "南", "东", "西", "北"}; + private Integer yearMonth; + /** + * 案例ID 唯一 + */ + private String caseId; + /** + * 链家案例id + */ + private String caseLianJiaId; + /** + * 链家小区编码 + */ + private String caseLianJiaCommunityId; + /** + * 房源标题 + */ + private String caseTitle; + /** + * 物业类型 + */ + private String cleanPropertyType; + /** + * 户型 + */ + private String caseApartmentLayout; + /** + * 房屋结构 + */ + private String caseHouseStructure; + /** + * 建筑面积 + */ + private BigDecimal caseArea; + /** + * 地下面积 + */ + private BigDecimal caseUndergroundArea; + /** + * 朝向 + */ + private String caseToward; + /** + * 朝向 + */ + private String cleanToward; + /** + * 楼层 + */ + private String caseStorey; + /** + * 总层 + */ + private Integer cleanTotalFloor; + /** + * 所在层 + */ + private String cleanCurrentFloorDesc; + /** + * 上架日期 + */ + private Date caseUpDate; + /** + * 下架日期 + */ + private Date caseDownDate; + /** + * 有无电梯 + */ + private String caseElevator; + /** + * 有无电梯 + */ + private Boolean cleanElevator; + /** + * 电梯梯户 + */ + private String caseTiHu; + + /** + * 装修 + */ + private String caseDecoration; + /** + * 装修 + */ + private String cleanDecoration; + /** + * 竣工年 + */ + private String caseYear; + /** + * 竣工年 + */ + private Integer cleanYear; + /** + * 地址 + */ + private String caseAddress; + /** + * + */ + private String vid; + /** + * 产权性质 + */ + private String caseChanQuanXingZhi; + /** + * 售价 + */ + private BigDecimal casePrice; + /** + * 总价 + */ + private BigDecimal cleanTotalPrice; + /** + * 单价 + */ + private BigDecimal cleanUnitPrice; + /** + * 小区名称 + */ + private String caseCommunityName; + /** + * 累计带看 + */ + private Integer caseVisitedNum; + /** + * 首次带看日 + */ + private Date caseFirstVisitTime; + /** + * 最近带看日 + */ + private Date caseLatestVisitTime; + /** + * 近15日带看 + */ + private Integer caseVisitedNum15; + /** + * 近30天带看 + */ + private Integer caseVisitedNum30; + /** + * 案例URL + */ + private String caseUrl; + /** + * 小区URL + */ + private String caseCommunityUrl; + /** + * 抓取日期 + */ + private Date caseGetDate; + /** + * 抓取网站名 + */ + private String caseProvider; + /** + * 小区名称-系统 + */ + private String uvCommunityName; + /** + * 小区地址-系统 + */ + private String uvCommunityAddress; + /** + * 区域 + */ + private String uvCounty; + /** + * 板块 + */ + private String uvBlock; + /** + * 环线 + */ + private String uvLoop; + /** + * 面积系数 + */ + private BigDecimal areaCoefficient; + /** + * 朝向系数 + */ + private BigDecimal towardCoefficient; + /** + * 楼层系数 + */ + private BigDecimal floorCoefficient; + /** + * 建成年代系数 + */ + private BigDecimal yearCoefficient; + /** + * 楼栋系数 + */ + private BigDecimal buildingCoefficient; + /** + * 最终成交日期 + */ + private Date caseLastDeal; + /** + * + */ + private String newCaseId; + + public static String[] getTowardArray() { + return towardArray; + } + + public static void setTowardArray(String[] towardArray) { + OriginalResidenceSaleOpeningCase.towardArray = towardArray; + } + + public String getCaseId() { + return caseId; + } + + public void setCaseId(String caseId) { + this.caseId = caseId; + } + + public String getCaseLianJiaId() { + return caseLianJiaId; + } + + public void setCaseLianJiaId(String caseLianJiaId) { + this.caseLianJiaId = caseLianJiaId; + } + + public String getCaseLianJiaCommunityId() { + return caseLianJiaCommunityId; + } + + public void setCaseLianJiaCommunityId(String caseLianJiaCommunityId) { + this.caseLianJiaCommunityId = caseLianJiaCommunityId; + } + + public String getCaseTitle() { + return caseTitle; + } + + public void setCaseTitle(String caseTitle) { + this.caseTitle = caseTitle; + } + + public String getCleanPropertyType() { + return cleanPropertyType; + } + + public void setCleanPropertyType(String cleanPropertyType) { + this.cleanPropertyType = cleanPropertyType; + } + + public String getCaseApartmentLayout() { + return caseApartmentLayout; + } + + public void setCaseApartmentLayout(String caseApartmentLayout) { + this.caseApartmentLayout = caseApartmentLayout; + } + + public String getCaseHouseStructure() { + return caseHouseStructure; + } + + public void setCaseHouseStructure(String caseHouseStructure) { + this.caseHouseStructure = caseHouseStructure; + } + + public BigDecimal getCaseArea() { + return caseArea; + } + + public void setCaseArea(BigDecimal caseArea) { + this.caseArea = caseArea; + } + + public BigDecimal getCaseUndergroundArea() { + return caseUndergroundArea; + } + + public void setCaseUndergroundArea(BigDecimal caseUndergroundArea) { + this.caseUndergroundArea = caseUndergroundArea; + } + + public String getCaseToward() { + return caseToward; + } + + public void setCaseToward(String caseToward) { + this.caseToward = caseToward; + } + + public String getCleanToward() { + return cleanToward; + } + + public void setCleanToward(String cleanToward) { + this.cleanToward = cleanToward; + } + + public String getCaseStorey() { + return caseStorey; + } + + public void setCaseStorey(String caseStorey) { + this.caseStorey = caseStorey; + } + + public Integer getCleanTotalFloor() { + return cleanTotalFloor; + } + + public void setCleanTotalFloor(Integer cleanTotalFloor) { + this.cleanTotalFloor = cleanTotalFloor; + } + + public String getCleanCurrentFloorDesc() { + return cleanCurrentFloorDesc; + } + + public void setCleanCurrentFloorDesc(String cleanCurrentFloorDesc) { + this.cleanCurrentFloorDesc = cleanCurrentFloorDesc; + } + + public Date getCaseUpDate() { + return caseUpDate; + } + + public void setCaseUpDate(Date caseUpDate) { + this.caseUpDate = caseUpDate; + } + + public Date getCaseDownDate() { + return caseDownDate; + } + + public void setCaseDownDate(Date caseDownDate) { + this.caseDownDate = caseDownDate; + } + + public String getCaseElevator() { + return caseElevator; + } + + public void setCaseElevator(String caseElevator) { + this.caseElevator = caseElevator; + } + + public Boolean getCleanElevator() { + return cleanElevator; + } + + public void setCleanElevator(Boolean cleanElevator) { + this.cleanElevator = cleanElevator; + } + + public String getCaseTiHu() { + return caseTiHu; + } + + public void setCaseTiHu(String caseTiHu) { + this.caseTiHu = caseTiHu; + } + + public String getCaseDecoration() { + return caseDecoration; + } + + public void setCaseDecoration(String caseDecoration) { + this.caseDecoration = caseDecoration; + } + + public String getCleanDecoration() { + return cleanDecoration; + } + + public void setCleanDecoration(String cleanDecoration) { + this.cleanDecoration = cleanDecoration; + } + + public String getCaseYear() { + return caseYear; + } + + public void setCaseYear(String caseYear) { + this.caseYear = caseYear; + } + + public Integer getCleanYear() { + return cleanYear; + } + + public void setCleanYear(Integer cleanYear) { + this.cleanYear = cleanYear; + } + + public String getCaseAddress() { + return caseAddress; + } + + public void setCaseAddress(String caseAddress) { + this.caseAddress = caseAddress; + } + + public String getVid() { + return vid; + } + + public void setVid(String vid) { + this.vid = vid; + } + + public String getCaseChanQuanXingZhi() { + return caseChanQuanXingZhi; + } + + public void setCaseChanQuanXingZhi(String caseChanQuanXingZhi) { + this.caseChanQuanXingZhi = caseChanQuanXingZhi; + } + + public BigDecimal getCasePrice() { + return casePrice; + } + + public void setCasePrice(BigDecimal casePrice) { + this.casePrice = casePrice; + } + + public BigDecimal getCleanTotalPrice() { + return cleanTotalPrice; + } + + public void setCleanTotalPrice(BigDecimal cleanTotalPrice) { + this.cleanTotalPrice = cleanTotalPrice; + } + + public BigDecimal getCleanUnitPrice() { + return cleanUnitPrice; + } + + public void setCleanUnitPrice(BigDecimal cleanUnitPrice) { + this.cleanUnitPrice = cleanUnitPrice; + } + + public String getCaseCommunityName() { + return caseCommunityName; + } + + public void setCaseCommunityName(String caseCommunityName) { + this.caseCommunityName = caseCommunityName; + } + + public Integer getCaseVisitedNum() { + return caseVisitedNum; + } + + public void setCaseVisitedNum(Integer caseVisitedNum) { + this.caseVisitedNum = caseVisitedNum; + } + + public Date getCaseFirstVisitTime() { + return caseFirstVisitTime; + } + + public void setCaseFirstVisitTime(Date caseFirstVisitTime) { + this.caseFirstVisitTime = caseFirstVisitTime; + } + + public Date getCaseLatestVisitTime() { + return caseLatestVisitTime; + } + + public void setCaseLatestVisitTime(Date caseLatestVisitTime) { + this.caseLatestVisitTime = caseLatestVisitTime; + } + + public Integer getCaseVisitedNum15() { + return caseVisitedNum15; + } + + public void setCaseVisitedNum15(Integer caseVisitedNum15) { + this.caseVisitedNum15 = caseVisitedNum15; + } + + public Integer getCaseVisitedNum30() { + return caseVisitedNum30; + } + + public void setCaseVisitedNum30(Integer caseVisitedNum30) { + this.caseVisitedNum30 = caseVisitedNum30; + } + + public String getCaseUrl() { + return caseUrl; + } + + public void setCaseUrl(String caseUrl) { + this.caseUrl = caseUrl; + } + + public String getCaseCommunityUrl() { + return caseCommunityUrl; + } + + public void setCaseCommunityUrl(String caseCommunityUrl) { + this.caseCommunityUrl = caseCommunityUrl; + } + + public Date getCaseGetDate() { + return caseGetDate; + } + + public void setCaseGetDate(Date caseGetDate) { + this.caseGetDate = caseGetDate; + } + + public String getCaseProvider() { + return caseProvider; + } + + public void setCaseProvider(String caseProvider) { + this.caseProvider = caseProvider; + } + + public String getUvCommunityName() { + return uvCommunityName; + } + + public void setUvCommunityName(String uvCommunityName) { + this.uvCommunityName = uvCommunityName; + } + + public String getUvCommunityAddress() { + return uvCommunityAddress; + } + + public void setUvCommunityAddress(String uvCommunityAddress) { + this.uvCommunityAddress = uvCommunityAddress; + } + + public String getUvCounty() { + return uvCounty; + } + + public void setUvCounty(String uvCounty) { + this.uvCounty = uvCounty; + } + + public String getUvBlock() { + return uvBlock; + } + + public void setUvBlock(String uvBlock) { + this.uvBlock = uvBlock; + } + + public String getUvLoop() { + return uvLoop; + } + + public void setUvLoop(String uvLoop) { + this.uvLoop = uvLoop; + } + + public BigDecimal getAreaCoefficient() { + return areaCoefficient; + } + + public void setAreaCoefficient(BigDecimal areaCoefficient) { + this.areaCoefficient = areaCoefficient; + } + + public BigDecimal getTowardCoefficient() { + return towardCoefficient; + } + + public void setTowardCoefficient(BigDecimal towardCoefficient) { + this.towardCoefficient = towardCoefficient; + } + + public BigDecimal getFloorCoefficient() { + return floorCoefficient; + } + + public void setFloorCoefficient(BigDecimal floorCoefficient) { + this.floorCoefficient = floorCoefficient; + } + + public BigDecimal getYearCoefficient() { + return yearCoefficient; + } + + public void setYearCoefficient(BigDecimal yearCoefficient) { + this.yearCoefficient = yearCoefficient; + } + + public BigDecimal getBuildingCoefficient() { + return buildingCoefficient; + } + + public void setBuildingCoefficient(BigDecimal buildingCoefficient) { + this.buildingCoefficient = buildingCoefficient; + } + + public Date getCaseLastDeal() { + return caseLastDeal; + } + + public void setCaseLastDeal(Date caseLastDeal) { + this.caseLastDeal = caseLastDeal; + } + + public void setNewCaseId(String newCaseId) { + this.newCaseId = newCaseId; + } + + /** + * 生成caseid,根据caseid来确定唯一案例,还有案例来源 + * + * @return + */ + public String getNewCaseId() { + return DigestUtils.md5DigestAsHex(getCaseLianJiaId().getBytes()); + } + + public Integer getYearMonth() { + return yearMonth; + } + + public void setYearMonth(Integer yearMonth) { + this.yearMonth = yearMonth; + } + + public void clear() { + clearPrice(); + clearElevator(); + clearDecoration(); + clearFloor(); + clearToward(); + clearYear(); + } + + private void clearYear() { + setCleanYear(new Integer(getCaseYear())); + } + + private void clearPrice() { + try { + // 总价 + setCleanTotalPrice(getCasePrice().multiply(new BigDecimal(10 * 1000))); + // 单价 + setCleanUnitPrice(getCleanTotalPrice().divide(getCaseArea(), 2)); + } catch (Exception e) { + + } + } + + // 装修 + private void clearDecoration() { + if (StringUtils.isNotNull(getCaseDecoration())) { + if (!"其他".equals(getCaseDecoration())) { + setCleanDecoration(getCaseDecoration()); + } + } + } + + // 电梯 + private void clearElevator() { + if (StringUtils.isNotNull(getCaseElevator())) { + if ("有".equals(getCaseElevator())) { + setCleanElevator(true); + } else if ("无".equals(getCaseElevator())) { + setCleanElevator(false); + } + } + } + + // 楼层 + private void clearFloor() { + if (StringUtils.isNotNull(getCaseStorey())) { + Pattern pattern = Pattern.compile("([高中低])楼层 \\(共(\\d+)层\\)"); + Matcher matcher = pattern.matcher(getCaseStorey()); + if (matcher.find()) { + String currentFloor = matcher.group(1); + String totalFloor = matcher.group(2); + setCleanTotalFloor(new Integer(totalFloor)); + if ("高".equals(currentFloor)) { + setCleanCurrentFloorDesc("高区"); + } else if ("中".equals(currentFloor)) { + setCleanCurrentFloorDesc("中区"); + } else if ("低".equals(currentFloor)) { + setCleanCurrentFloorDesc("低区"); + } + } else { + pattern = Pattern.compile("地下室 \\(共(\\d+)层\\)"); + matcher = pattern.matcher(getCaseStorey()); + if (matcher.find()) { + String totalFloor = matcher.group(1); + setCleanTotalFloor(new Integer(totalFloor)); + } + } + + } + } + + private void clearToward() { + // 排序规则 + String[] segments = this.getCaseToward().split(" "); + String cleanTag = segments[0].trim(); + if (1 == segments.length) { + if (!"".equals(cleanTag) && !"暂无数据".equals(cleanTag)) { + this.setCleanToward(cleanTag); + } + } else { + // 排序规则 + int index = towardArray.length; + for (int j = 0; j < towardArray.length; j++) { + for (String seg : segments) { + if (seg.equals(towardArray[j])) { + if (j < index) + index = j; + } + } + } + this.setCleanToward(towardArray[index]); + } + } + + @Override + public String toString() { + return "OriginalResidenceOpeningCase{" + + "yearMonth=" + yearMonth + + ", caseId='" + caseId + '\'' + + ", caseLianJiaId='" + caseLianJiaId + '\'' + + ", caseLianJiaCommunityId='" + caseLianJiaCommunityId + '\'' + + ", caseTitle='" + caseTitle + '\'' + + ", cleanPropertyType='" + cleanPropertyType + '\'' + + ", caseApartmentLayout='" + caseApartmentLayout + '\'' + + ", caseHouseStructure='" + caseHouseStructure + '\'' + + ", caseArea=" + caseArea + + ", caseUndergroundArea=" + caseUndergroundArea + + ", caseToward='" + caseToward + '\'' + + ", cleanToward='" + cleanToward + '\'' + + ", caseStorey='" + caseStorey + '\'' + + ", cleanTotalFloor=" + cleanTotalFloor + + ", cleanCurrentFloorDesc='" + cleanCurrentFloorDesc + '\'' + + ", caseUpDate=" + caseUpDate + + ", caseDownDate=" + caseDownDate + + ", caseElevator='" + caseElevator + '\'' + + ", cleanElevator=" + cleanElevator + + ", caseTiHu='" + caseTiHu + '\'' + + ", caseDecoration='" + caseDecoration + '\'' + + ", cleanDecoration='" + cleanDecoration + '\'' + + ", caseYear='" + caseYear + '\'' + + ", cleanYear=" + cleanYear + + ", caseAddress='" + caseAddress + '\'' + + ", vid='" + vid + '\'' + + ", caseChanQuanXingZhi='" + caseChanQuanXingZhi + '\'' + + ", casePrice=" + casePrice + + ", cleanTotalPrice=" + cleanTotalPrice + + ", cleanUnitPrice=" + cleanUnitPrice + + ", caseCommunityName='" + caseCommunityName + '\'' + + ", caseVisitedNum=" + caseVisitedNum + + ", caseFirstVisitTime=" + caseFirstVisitTime + + ", caseLatestVisitTime=" + caseLatestVisitTime + + ", caseVisitedNum15=" + caseVisitedNum15 + + ", caseVisitedNum30=" + caseVisitedNum30 + + ", caseUrl='" + caseUrl + '\'' + + ", caseCommunityUrl='" + caseCommunityUrl + '\'' + + ", caseGetDate=" + caseGetDate + + ", caseProvider='" + caseProvider + '\'' + + ", uvCommunityName='" + uvCommunityName + '\'' + + ", uvCommunityAddress='" + uvCommunityAddress + '\'' + + ", uvCounty='" + uvCounty + '\'' + + ", uvBlock='" + uvBlock + '\'' + + ", uvLoop='" + uvLoop + '\'' + + ", areaCoefficient=" + areaCoefficient + + ", towardCoefficient=" + towardCoefficient + + ", floorCoefficient=" + floorCoefficient + + ", yearCoefficient=" + yearCoefficient + + ", buildingCoefficient=" + buildingCoefficient + + ", caseLastDeal=" + caseLastDeal + + ", newCaseId='" + newCaseId + '\'' + + '}'; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCaseQueryModel.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCaseQueryModel.java new file mode 100644 index 000000000..7f76107d1 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/domain/OriginalResidenceSaleOpeningCaseQueryModel.java @@ -0,0 +1,23 @@ +package com.ruoyi.project.data.cases.domain; + +public class OriginalResidenceSaleOpeningCaseQueryModel extends OriginalResidenceSaleOpeningCase { + + private Integer pageIndex; + private Integer pageSize; + + public Integer getPageIndex() { + return pageIndex; + } + + public void setPageIndex(Integer pageIndex) { + this.pageIndex = pageIndex; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleClosingCaseMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleClosingCaseMapper.java new file mode 100644 index 000000000..e606d27eb --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleClosingCaseMapper.java @@ -0,0 +1,41 @@ +package com.ruoyi.project.data.cases.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@DS("compute") +public interface OriginalResidenceSaleClosingCaseMapper { + + /** + * 创建表 + * + * @param yearMonth + * @return + */ + int createTable(@Param("yearMonth") Integer yearMonth); + + /** + * 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM + * @param yearMonth + * @return + */ + int createCleanTable(@Param("yearMonth") Integer yearMonth); + + /** + * 分页总数 + * + * @param originalResidenceSaleOpeningCase + * @return + */ + Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase); + + /** + * @param queryModel + * @return + */ + List pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleOpeningCaseMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleOpeningCaseMapper.java new file mode 100644 index 000000000..e375b591a --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/OriginalResidenceSaleOpeningCaseMapper.java @@ -0,0 +1,50 @@ +package com.ruoyi.project.data.cases.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCaseQueryModel; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@DS("compute") +public interface OriginalResidenceSaleOpeningCaseMapper { + + /** + * 创建表 + * + * @param yearMonth + * @return + */ + int createTable(@Param("yearMonth") Integer yearMonth); + + /** + * 创建清洗完成之后的表ODS_HOUSINGCASELISTED_LJ_YYYYMM + * + * @param yearMonth + * @return + */ + int createCleanTable(@Param("yearMonth") Integer yearMonth); + + /** + * 案例汇总表(挂牌、成交) + * + * @param yearMonth + * @return + */ + int createAssembleTable(@Param("yearMonth") Integer yearMonth); + + /** + * 分页总数 + * + * @param originalResidenceSaleOpeningCase + * @return + */ + Integer pageCount(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase); + + /** + * @param queryModel + * @return + */ + List pageList(OriginalResidenceSaleOpeningCaseQueryModel queryModel); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleClosingCaseMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleClosingCaseMapper.java new file mode 100644 index 000000000..3be390c17 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleClosingCaseMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.project.data.cases.mapper.sync; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@DS("calc") +public interface DownloadOriginalResidenceSaleClosingCaseMapper { + + /** + * @return + */ + List download(@Param("yearMonth") Integer yearMonth); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleOpeningCaseMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleOpeningCaseMapper.java new file mode 100644 index 000000000..1960b06a2 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/DownloadOriginalResidenceSaleOpeningCaseMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.project.data.cases.mapper.sync; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; + +import java.util.List; + +@DS("oldProd") +public interface DownloadOriginalResidenceSaleOpeningCaseMapper { + + /** + * @return + */ + List download(); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/SyncOriginalResidenceSaleOpeningCaseMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/SyncOriginalResidenceSaleOpeningCaseMapper.java new file mode 100644 index 000000000..37352be1d --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/mapper/sync/SyncOriginalResidenceSaleOpeningCaseMapper.java @@ -0,0 +1,23 @@ +package com.ruoyi.project.data.cases.mapper.sync; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; +import org.apache.ibatis.annotations.Param; + +@DS("calc") +public interface SyncOriginalResidenceSaleOpeningCaseMapper { + + /** + * 创建挂牌案例表 + * @param yearMonth + */ + int createTable(@Param("yearMonth") Integer yearMonth); + + /** + * + * @param originalResidenceSaleOpeningCase + * @return + */ + int insert(OriginalResidenceSaleOpeningCase originalResidenceSaleOpeningCase); + +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleClosingCaseService.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleClosingCaseService.java new file mode 100644 index 000000000..7f5c10a9a --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleClosingCaseService.java @@ -0,0 +1,5 @@ +package com.ruoyi.project.data.cases.service; + +public interface IOriginalResidenceSaleClosingCaseService { + void pullData(); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleOpeningCaseService.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleOpeningCaseService.java new file mode 100644 index 000000000..7965278b7 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/IOriginalResidenceSaleOpeningCaseService.java @@ -0,0 +1,5 @@ +package com.ruoyi.project.data.cases.service; + +public interface IOriginalResidenceSaleOpeningCaseService { + void pullData(); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleClosingCaseServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleClosingCaseServiceImpl.java new file mode 100644 index 000000000..35ce70311 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleClosingCaseServiceImpl.java @@ -0,0 +1,109 @@ +package com.ruoyi.project.data.cases.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.common.utils.LoadUtil; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleClosingCase; +import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleClosingCaseMapper; +import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleClosingCaseMapper; +import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +@Service +@DS("compute") +public class OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalResidenceSaleClosingCaseService { + + private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleClosingCaseServiceImpl.class); + + @Autowired + private OriginalResidenceSaleClosingCaseMapper originalResidenceSaleClosingCaseMapper; + @Autowired + private DownloadOriginalResidenceSaleClosingCaseMapper downloadOriginalResidenceSaleClosingCaseMapper; + @Autowired + private NamedParameterJdbcTemplate namedParameterJdbcTemplate; + @Autowired + private JdbcTemplate jdbcTemplate; + + /** + * + */ + @Scheduled(cron = "0 0 5 9 * ?") + @Override + public void pullData() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + Integer targetTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH))); + calendar.add(Calendar.MONTH, 1); + Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH) + 1)); + + prepare(computeTableRoute); + List list = + downloadOriginalResidenceSaleClosingCaseMapper.download(targetTableRoute); + list.parallelStream().forEach(originalResidenceSaleClosingCase -> { + originalResidenceSaleClosingCase.setCaseId(originalResidenceSaleClosingCase.generateCaseId()); + originalResidenceSaleClosingCase.setCleanPropertyType(originalResidenceSaleClosingCase.refinePropertyType()); +// originalResidenceSaleClosingCase.setCleanCurrentFloor(originalResidenceSaleClosingCase +// .refineCurrentFloor()); +// originalResidenceSaleClosingCase.setCleanBuildingAddress(originalResidenceSaleClosingCase +// .refineBuildingAddress()); + }); + running(computeTableRoute, list); + after(computeTableRoute); + } + + /** + * 准备工作 创建表 + * + * @param computeTableRoute + */ + public void prepare(Integer computeTableRoute) { + originalResidenceSaleClosingCaseMapper.createTable(computeTableRoute); + originalResidenceSaleClosingCaseMapper.createCleanTable(computeTableRoute); + } + + /** + * 批量入库 + * + * @param computeTableRoute + * @param list + */ + public void running(Integer computeTableRoute, List list) { + SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray()); + int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" + + ".original_residence_sale_closing_case_" + computeTableRoute + "(case_id,case_county_name," + + "case_block_name,case_loopline_name,case_community_name,case_address,case_area," + + "case_unit_price,case_total_price,case_house_type,case_signing_date,case_register_date," + + "case_agency_name,case_agency_type,case_seller_type,case_buyer_type,case_birthday," + + "case_deal_type,clean_property_type,create_time) " + + "values (:caseId,:caseCountyName,:caseBlockName,:caseLoopName,:caseCommunityName," + + ":caseAddress,:caseArea,:caseUnitPrice,:caseTotalPrice,:caseHouseType,:caseSigningDate," + + ":caseRegisterDate,:agencyName,:agencyType,:sellerType,:buyerType,:birthday," + + ":cleanCaseType,:cleanPropertyType,GETDATE());", + batchParams); + } + + /** + * 匹配数据 + * + * @param yearMonth + */ + public void after(Integer yearMonth) { + // 清洗挂牌案例 + String rawSql = LoadUtil.loadContent("sql-template/clear_closing_case.sql"); + String sql = rawSql.replace("#yearMonth#", yearMonth.toString()); + jdbcTemplate.update(sql); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleOpeningCaseServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleOpeningCaseServiceImpl.java new file mode 100644 index 000000000..7c46df7ef --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/cases/service/impl/OriginalResidenceSaleOpeningCaseServiceImpl.java @@ -0,0 +1,122 @@ +package com.ruoyi.project.data.cases.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.common.utils.LoadUtil; +import com.ruoyi.project.data.cases.domain.OriginalResidenceSaleOpeningCase; +import com.ruoyi.project.data.cases.mapper.OriginalResidenceSaleOpeningCaseMapper; +import com.ruoyi.project.data.cases.mapper.sync.DownloadOriginalResidenceSaleOpeningCaseMapper; +import com.ruoyi.project.data.cases.mapper.sync.SyncOriginalResidenceSaleOpeningCaseMapper; +import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +@Service +@DS("compute") +public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalResidenceSaleOpeningCaseService { + + private static Logger logger = LoggerFactory.getLogger(OriginalResidenceSaleOpeningCaseServiceImpl.class); + + @Autowired + private OriginalResidenceSaleOpeningCaseMapper originalResidenceSaleOpeningCaseMapper; + @Autowired + private DownloadOriginalResidenceSaleOpeningCaseMapper downloadOriginalResidenceSaleOpeningCaseMapper; + @Autowired + private SyncOriginalResidenceSaleOpeningCaseMapper syncOriginalResidenceSaleOpeningCaseMapper; + @Autowired + private NamedParameterJdbcTemplate namedParameterJdbcTemplate; + @Autowired + private JdbcTemplate jdbcTemplate; + + /** + * + */ + @Scheduled(cron = "0 0 5 25 * ?") + @Override + public void pullData() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + Integer syncTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH))); + Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH) + 1)); + calendar.add(Calendar.MONTH, 1); + Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH) + 1)); + + prepare(computeTableRoute, syncTableRoute); + List list = downloadOriginalResidenceSaleOpeningCaseMapper.download(); + list.parallelStream().forEach(originalResidenceOpeningCase -> { + originalResidenceOpeningCase.clear(); + originalResidenceOpeningCase.setYearMonth(syncTableRoute); +// logger.debug(originalResidenceOpeningCase.toString()); + syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase); + }); + running(computeTableRoute, syncTableRoute, list); + after(computeTableRoute, lastYearMonth); + } + + /** + * 准备工作 创建表 + * + * @param computeTableRoute + * @param syncTableRoute + */ + public void prepare(Integer computeTableRoute, Integer syncTableRoute) { + originalResidenceSaleOpeningCaseMapper.createTable(computeTableRoute); + originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute); + syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute); + } + + /** + * 批量入库 + * + * @param computeTableRoute + * @param list + */ + public void running(Integer computeTableRoute, Integer syncTableRoute, List list) { + SqlParameterSource[] batchParams = SqlParameterSourceUtils.createBatch(list.toArray()); + int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("insert into dbo" + + ".original_residence_sale_opening_case_" + computeTableRoute + "(case_id, case_lianjia_id, " + + "case_lianjia_community_id, case_title, clean_property_type, case_apartment_layout, " + + "case_house_structure, case_area, case_underground_area, case_toward, clean_toward, " + + "case_storey, clean_total_floor, clean_current_floor_desc, case_elevator, clean_elevator, " + + "case_tihu, case_decoration, clean_decoration, case_year, clean_year, case_address, " + + "case_price, clean_unit_price, clean_total_price, case_community_name, case_visited_num, " + + "case_visited_num_15, case_visited_num_30, case_latest_deal_date, case_latest_visited_date, " + + "case_first_visited_date, case_url, case_community_url, case_get_date, case_provider, " + + "create_time) values (:newCaseId,:caseLianJiaId,:caseLianJiaCommunityId,:caseTitle," + + ":cleanPropertyType," + + ":caseApartmentLayout,:caseHouseStructure,:caseArea,:caseUndergroundArea,:caseToward," + + ":cleanToward,:caseStorey,:cleanTotalFloor,:cleanCurrentFloorDesc,:caseElevator," + + ":cleanElevator,:caseTiHu,:caseDecoration,:cleanDecoration,:caseYear,:cleanYear,:caseAddress," + + ":casePrice,:cleanUnitPrice,:cleanTotalPrice,:caseCommunityName,:caseVisitedNum," + + ":caseVisitedNum15,:caseVisitedNum30,NULL,:caseLatestVisitTime,:caseFirstVisitTime,:caseUrl," + + ":caseCommunityUrl,:caseGetDate,:caseProvider,GETDATE());", + batchParams); + } + + /** + * 匹配数据 + * + * @param yearMonth + */ + public void after(Integer yearMonth, Integer lastYearMonth) { + // 清洗挂牌案例 + String rawSql = LoadUtil.loadContent("sql-template/clear_opening_case.sql"); + String sql = rawSql.replace("#yearMonth#", yearMonth.toString()) + .replace("#lastYearMonth#", lastYearMonth.toString()); + jdbcTemplate.update(sql); + // 作价 + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/BasePriceController.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/BasePriceController.java new file mode 100644 index 000000000..81710b2a6 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/BasePriceController.java @@ -0,0 +1,36 @@ +package com.ruoyi.project.data.price.controller; + +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.framework.web.page.TableSupport; +import com.ruoyi.project.data.basis.domain.UVBasePrice; +import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel; +import com.ruoyi.project.data.basis.service.IUVBasePriceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/data/base/price") +public class BasePriceController extends BaseController { + + @Autowired + private IUVBasePriceService basePriceService; + + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/list") + public TableDataInfo list(UVBasePriceQueryModel queryModel) { + int pageIndex = ServletUtils.getParameterToInt(TableSupport.PAGE_NUM); + int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE); + queryModel.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize); + queryModel.setPageSize(pageSize); + int total = basePriceService.pageCount(queryModel); + List list = basePriceService.pageList(queryModel); + return getDataTable(list, total); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ComputeResidenceSaleBasePriceController.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ComputeResidenceSaleBasePriceController.java index 58115efad..60fe7a518 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ComputeResidenceSaleBasePriceController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ComputeResidenceSaleBasePriceController.java @@ -1,4 +1,17 @@ package com.ruoyi.project.data.price.controller; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.framework.web.page.TableSupport; +import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + public class ComputeResidenceSaleBasePriceController { + } diff --git a/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleClosingCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleClosingCaseMapper.xml new file mode 100644 index 000000000..3ff88a250 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleClosingCaseMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleOpeningCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleOpeningCaseMapper.xml new file mode 100644 index 000000000..ee95f94c3 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/DownloadOriginalResidenceSaleOpeningCaseMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleClosingCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleClosingCaseMapper.xml new file mode 100644 index 000000000..32881e467 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleClosingCaseMapper.xml @@ -0,0 +1,74 @@ + + + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + CREATE TABLE ${targetTableName} + ( + id bigint identity (1,1) not null primary key, + case_id varchar(32) not null, + case_county_name nvarchar(20) null, + case_block_name nvarchar(20) null, + case_loopline_name nvarchar(20) null, + case_community_name nvarchar(200) null, + case_address nvarchar(500) not null, + case_area decimal(18, 2) not null, + case_unit_price decimal(18, 2) not null, + case_total_price decimal(18, 2) not null, + case_house_type nvarchar(20) null, + case_signing_date date null, + case_register_date date null, + case_current_floor int null, + case_house_property nvarchar(20) null, + case_apartment_layout nvarchar(20) null, + case_compute_unit_price decimal(18, 2) null, + case_compute_total_price decimal(18, 2) null, + case_ref_unit_price decimal(18, 2) null, + case_ref_total_price decimal(18, 2) null, + case_agency_name nvarchar(200) null, + case_agency_type nvarchar(50) null, + case_seller_type nvarchar(20) null, + case_buyer_type nvarchar(20) null, + case_birthday date null, + case_deal_type int not null, + clean_condo_id nvarchar(20) null, + clean_building_id nvarchar(20) null, + clean_community_id nvarchar(20) null, + clean_condo_address nvarchar(500) null, + clean_property_type nvarchar(20) not null, + create_time datetime not null, + clean_current_floor int null, + clean_building_address nvarchar(200) null + ); + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + CREATE TABLE ${targetTableName} + ( + SID int NOT NULL IDENTITY(1, 1) , + case_id varchar(32) not null, + ProjectID bigint NULL, + BuildingID bigint NULL, + Area decimal (18, 2) NULL, + UpperFloorSum nvarchar (32) null, + UpperFloorNum nvarchar (32) NULL, + AreaCoff decimal (7, 4) NULL, + FloorCoff decimal (7, 4) NULL, + BuildingCoff decimal (7, 4) NULL, + PriceTotal decimal (18, 2) NOT NULL, + PriceUnit decimal (18, 2) NOT NULL, + PriceUnitAdj decimal (18, 2) NOT NULL, + DateContract date NULL + ); + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleOpeningCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleOpeningCaseMapper.xml new file mode 100644 index 000000000..da8113f96 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleOpeningCaseMapper.xml @@ -0,0 +1,168 @@ + + + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + CREATE TABLE ${targetTableName} + ( + case_id varchar (32) NOT NULL, + case_lianjia_id nvarchar (50) NOT null primary key, + case_lianjia_community_id nvarchar (50) NOT NULL, + case_title nvarchar (500) NOT NULL, + clean_property_type nvarchar (20) NULL, + case_apartment_layout nvarchar (500) NOT NULL, + case_house_structure nvarchar (50) NULL, + case_area decimal (10, 2) NOT NULL, + case_underground_area decimal (10, 2) NULL, + case_toward nvarchar (50) NOT NULL, + clean_toward nvarchar (50) NULL, + case_storey nvarchar (20) NOT NULL, + clean_total_floor int NOT NULL, + clean_current_floor_desc nvarchar (20) NULL, + case_elevator nvarchar (20) NULL, + clean_elevator nvarchar (20) NULL, + case_tihu nvarchar (20) NULL, + case_decoration nvarchar (20) NULL, + clean_decoration nvarchar (50) NULL, + case_year int NOT NULL, + clean_year int NOT NULL, + case_address nvarchar (500) NULL, + case_vid nvarchar (500) NULL, + case_chan_quan_xing_zhi nvarchar (200) NULL, + case_price decimal (18, 2) NOT NULL, + clean_unit_price decimal (18, 2) NOT NULL, + clean_total_price decimal (18, 2) NOT NULL, + case_community_name nvarchar (500) NULL, + case_visited_num int NOT NULL, + case_visited_num_15 int NOT NULL, + case_visited_num_30 int NOT NULL, + case_latest_deal_date date NULL, + case_latest_visited_date date NULL, + case_first_visited_date date NULL, + case_url nvarchar (500) NOT NULL, + case_community_url nvarchar (500) NOT NULL, + case_get_date date NOT NULL, + case_provider nvarchar (50) NOT NULL, + uv_community_name nvarchar (500) NULL, + uv_community_address nvarchar (1024) NULL, + uv_community_id nvarchar (20) NULL, + uv_building_id nvarchar (20) NULL, + uv_county nvarchar (50) NULL, + uv_block nvarchar (50) NULL, + uv_loop nvarchar (50) NULL, + area_coefficient decimal (18, 6) NULL, + toward_coefficient decimal (18, 6) NULL, + floor_coefficient decimal (18, 6) NULL, + decoration_coefficient int NULL, + year_coefficient decimal (18, 6) NULL, + building_coefficient decimal (18, 6) NULL, + adjust_unit_price decimal (18, 2) NULL, + clean_project_level nvarchar (50) NULL, + create_time datetime NOT NULL + ); + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + CREATE TABLE ${targetTableName} + ( + case_id varchar(32) not null, + HouseholdsID_LJ bigint not null primary key, + ProjectID_LJ bigint null, + ProjectID bigint null, + Roomtype nvarchar(64) null, + Area decimal(18, 2) null, + Towards nvarchar(64) null, + UpperFloorSum nvarchar(32) null, + UpperFloorNum nvarchar(32) null, + Elevator tinyint null, + Decoration nvarchar(64) null, + Year int null, + AreaCoff decimal(7, 4) null, + TowardsCoff decimal(7, 4) null, + FloorCoff decimal(7, 4) null, + DecorationRng int null, + YearCoff decimal(7, 4) null, + BuildingCoff decimal(7, 4) null, + PriceTotal decimal(18, 2) null, + PriceUnit decimal(18, 2) not null, + PriceUnitAdj decimal(18, 2) not null, + Visited_Num int null, + First_Visit_Time date null, + Visited_Num_15 int null, + Visited_Num_30 int null, + Status tinyint null, + AdjustedValue decimal(18, 2) null, + AdjustedPst decimal(18, 6) null, + AdjustedCumValue decimal(18, 2) null, + AdjustedCumPst decimal(18, 6) null, + AdjustedCumValueAbs decimal(18, 2) null, + AdjustedCumPstAbs decimal(18, 6) null, + AdjustedCumNum int null, + PriceTotalIn decimal(18, 2) null, + PriceTotalOut decimal(18, 2) null, + PriceDateIn date null, + PriceDateOut date null + ); + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + create table ${targetTableName} + ( + SID int primary key identity + , case_id varchar(32) not null + , HouseholdsID_LJ bigint + , ProjectID_LJ bigint + , ProjectID bigint --modified + , ProjectName nvarchar(1024) + , ProjectAddr nvarchar(1024) + , County nvarchar(512) + , Block nvarchar(512) + , Loop nvarchar(512) + , Roomtype nvarchar(64) + , Area decimal(18, 2) + , Towards nvarchar(64) + , UpperFloorSum nvarchar(32) + , UpperFloorNum nvarchar(32) + , Elevator tinyint + , Decoration nvarchar(64) + , Year int + , AreaCoff decimal(7, 4) + , TowardsCoff decimal(7, 4) + , FloorCoff decimal(7, 4) + , DecorationRng int + , YearCoff decimal(7, 4) + , BuildingCoff decimal(7, 4) + , BasePrice_1 decimal(18, 2) + , PriceTotal decimal(18, 2) not null + , PriceUnit decimal(18, 2) not null + , PriceUnitAdj decimal(18, 2) not null + , Visited_Num int + , First_Visit_Time date + , Visited_Num_15 int + , Visited_Num_30 int + , Status tinyint + , AdjustedValue decimal(18, 2) + , AdjustedPst decimal(18, 6) + , AdjustedCumValue decimal(18, 2) + , AdjustedCumPst decimal(18, 6) + , AdjustedCumValueAbs decimal(18, 2) + , AdjustedCumPstAbs decimal(18, 6) + , AdjustedCumNum int + , PriceTotalIn decimal(18, 2) + , PriceDateIn date + ); + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/SyncOriginalResidenceOpeningCaseMapper.xml b/ruoyi/src/main/resources/mybatis/data/SyncOriginalResidenceOpeningCaseMapper.xml new file mode 100644 index 000000000..e14c76304 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/SyncOriginalResidenceOpeningCaseMapper.xml @@ -0,0 +1,87 @@ + + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NULL + CREATE TABLE ${targetTableName} + ( + SID int NOT NULL IDENTITY(1, 1) primary key, + llid bigint NULL, + lcid bigint NULL, + Name nvarchar (1024) NULL, + Roomtype nvarchar (50) NULL, + Area decimal (18, 2) NULL, + Towards nvarchar (50) NULL, + Storey nvarchar (50) NULL, + Lastdeal date NULL, + Condoelev nvarchar (50) NULL, + Decoration nvarchar (50) NULL, + Year int NULL, + Address nvarchar (1024) NULL, + Price decimal (18, 2) NULL, + Cname nvarchar (1024) NULL, + Visited_Num int NULL, + First_Visit_Time date NULL, + Visited_Num_15 int NULL, + Visited_Num_30 int NULL, + Url nvarchar (512) NULL, + Curl nvarchar (512) NULL, + CurlDate date NULL + ); + + truncate table ${targetTableName} + + + + insert into dbo.ODS_HOUSINGCASELISTED_LJ_${yearMonth}_RAW + ( + llid + , lcid + , Name + , Roomtype + , Area + , Towards + , Storey + , Lastdeal + , Condoelev + , Decoration + , Year + , Address + , Price + , Cname + , Visited_Num + , First_Visit_Time + , Visited_Num_15 + , Visited_Num_30 + , Url + , Curl + , CurlDate + ) values + ( + #{caseLianJiaId}, + #{caseLianJiaCommunityId}, + #{caseTitle}, + #{caseApartmentLayout}, + #{caseArea}, + #{caseToward}, + #{caseStorey}, + #{caseLastDeal,jdbcType=DATE}, + #{caseElevator}, + #{caseDecoration}, + #{caseYear}, + #{caseAddress}, + #{casePrice}, + #{caseCommunityName}, + #{caseVisitedNum}, + #{caseFirstVisitTime,jdbcType=DATE}, + #{caseVisitedNum15}, + #{caseVisitedNum30}, + #{caseUrl}, + #{caseCommunityUrl}, + #{caseGetDate,jdbcType=DATE} + ) + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/UVBasePriceMapper.xml b/ruoyi/src/main/resources/mybatis/data/UVBasePriceMapper.xml new file mode 100644 index 000000000..4b1ed925d --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/UVBasePriceMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/sql-template/clear_closing_case.sql b/ruoyi/src/main/resources/sql-template/clear_closing_case.sql new file mode 100644 index 000000000..2aefe5341 --- /dev/null +++ b/ruoyi/src/main/resources/sql-template/clear_closing_case.sql @@ -0,0 +1,89 @@ +--二手房成交记录处理 +select t.*, left(addr_floornum,charindex('|', addr_floornum, 1)-1) as 楼栋地址, + substring(addr_floornum, charindex('|', addr_floornum, 1)+1, len(addr_floornum)-charindex('|', addr_floornum, 1)) as "所在层" +into #temp +from ( + select a.*, dbo.remove_last_numbers(a.case_address) as addr_floornum + from dbo.original_residence_sale_closing_case_#yearMonth# a +) t; + +update #temp set case_county_name=case_county_name+'区'; +update #temp set case_county_name='浦东新区' where case_county_name='浦东区'; + + +--成交插入到临时表 #result +select a.*, b.楼栋ID, b.小区ID,cast(left(case_signing_date,7) as varchar(16)) as 年月 +into #result +from #temp a +left join ( + select row_number()over(partition by 区县, 地址 order by newid()) sq, 楼栋ID, 小区ID, 区县, 地址 from obpm_LianCheng_Data.dbo.AI单套地址20190508 +) b +on a.case_county_name = b.区县 and a.楼栋地址 = b.地址 and b.sq=1; + + +update b set b.clean_building_address=a.楼栋地址, +b.clean_current_floor=a.所在层, +b.clean_building_id=a.楼栋ID, +b.clean_community_id=a.小区ID, +b.case_county_name=left(a.case_county_name, 2) +from #result a join dbo.original_residence_sale_closing_case_#yearMonth# b on a.id=b.id + + +insert into dbo.ODS_HOUSINGCASE_DEAL_#yearMonth# +( + case_id + , ProjectID + , BuildingID + , Area + , UpperFloorSum + , UpperFloorNum + , AreaCoff + , FloorCoff + , BuildingCoff + , PriceTotal + , PriceUnit + , PriceUnitAdj + , DateContract +) +select a.case_id + , a.clean_community_id + , a.clean_building_id + , a.case_area + , b.地上层数 + , a.clean_current_floor + , d.CoefficientA * a.case_area + d.CoefficientB as AreaCoff + , 1 as FloorCoff + , e.Coefficient as BuildingCoff + , a.case_total_price + , a.case_total_price * 1.0 / a.case_area as PriceUnit + , a.case_total_price * 1.0 / a.case_area / isnull(d.CoefficientA * a.case_area + d.CoefficientB, 1) + / isnull(e.Coefficient, 1) as PriceUnitAdj + , case_signing_date +from dbo.original_residence_sale_closing_case_#yearMonth# a + left join obpm_LianCheng_Data.dbo.AI楼栋数据_610 b + on a.clean_community_id = b.AI小区ID + and a.clean_building_id = b.AI楼栋ID + left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 c + on a.clean_community_id = c.ITEM_AIRAID and c.ITEM_PROJECTTYPE = '1' + left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 f + on f.ITEM_DICVALUE = c.ITEM_PROPERTYLEVEL and f.ITEM_DICTYPE='物业档次' + left join + ( + select ProjectLevel + , LowerKey + , UpperKey + , CoefficientA + , CoefficientB + from obpm_LianCheng_Data.dbo.DIM_PARAMETERS + where CoffType = '面积修正(链家挂牌)' + and ProjectType = '公寓' + ) d --面积修正 + on f.ITEM_DICTEXT = d.ProjectLevel + and + ( + a.case_area > d.LowerKey + and a.case_area <= d.UpperKey + ) + left join obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF e + on a.clean_building_id = e.BuildingID +where a.case_area > 0 ; \ No newline at end of file diff --git a/ruoyi/src/main/resources/sql-template/clear_opening_case.sql b/ruoyi/src/main/resources/sql-template/clear_opening_case.sql new file mode 100644 index 000000000..6dc22d2b7 --- /dev/null +++ b/ruoyi/src/main/resources/sql-template/clear_opening_case.sql @@ -0,0 +1,499 @@ +update a +set a.uv_community_id=b.ITEM_ProjectID, + a.uv_building_id=b.ITEM_BuildingID, + a.area_coefficient= D.CoefficientA * A.case_area + D.CoefficientB, + a.toward_coefficient = e.Coefficient, + a.floor_coefficient= f.Coefficient, + a.decoration_coefficient=g.Coefficient, + a.year_coefficient=h.Coefficient, + a.building_coefficient=i.Coefficient, + a.adjust_unit_price = (A.clean_unit_price - isnull(G.Coefficient, 0)) * 1.0 / + isnull(D.CoefficientA * A.case_area + D.CoefficientB, 1) / isnull(E.Coefficient, 1) / + isnull(F.Coefficient, 1) / isnull(H.Coefficient, 1) / isnull(I.Coefficient, 1), + a.clean_project_level = C.PROJECTLEVEL, + a.uv_county=c.countyName, + a.uv_block=c.blockName, + a.uv_loop=c.loopName, + a.uv_community_name=c.ITEM_RANAME, + a.uv_community_address=c.ITEM_RAADRESS +from original_residence_sale_opening_case_#yearMonth# A + left join obpm_LianCheng_Data.dbo.TLK_链家小区 B + on A.case_lianjia_community_id = B.ITEM_ProjectID_LJ + left join + ( + select X.ITEM_AIRAID + , y.ITEM_DICTEXT as PROJECTLEVEL + , y2.ITEM_DICTEXT as countyName + , y3.ITEM_DICTEXT as blockName + , y4.ITEM_DICTEXT as loopName + , x.ITEM_RANAME + , x.ITEM_RAADRESS + from obpm_LianCheng_Data.dbo.TLK_小区信息管理 x + left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y + on x.ITEM_PROPERTYLEVEL = y.ITEM_DICVALUE + left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y2 -- 区域 + on x.ITEM_DISTRICT1 = y2.ITEM_DICVALUE + left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y3 -- 板块 + on x.ITEM_SECTOR121 = y3.ITEM_DICVALUE + left join obpm_LianCheng_Data.dbo.TLK_字典数据信息 y4 -- 环线 + on x.ITEM_CIRCLEPOSITION = y4.ITEM_DICVALUE + where X.ITEM_PROJECTTYPE = '1' + and y.ITEM_DICTYPE = '物业档次' + and y2.ITEM_DICTYPE = '区域' + and y3.ITEM_DICTYPE = '板块' + and y4.ITEM_DICTYPE = '环线' + ) C + on B.ITEM_ProjectID = C.ITEM_AIRAID + left join + ( + select ProjectLevel, LowerKey, UpperKey, Coefficient, CoefficientA, CoefficientB + from obpm_LianCheng_Data.dbo.DIM_PARAMETERS + where CoffType = '面积修正(链家挂牌)' + and ProjectType = '公寓' + ) D --面积修正 + on C.PROJECTLEVEL = D.ProjectLevel + and + ( + A.case_area > D.LowerKey + and A.case_area <= D.UpperKey + ) + left join + ( + select SingleKey, Coefficient + from obpm_LianCheng_Data.dbo.DIM_PARAMETERS + where CoffType = '朝向(链家挂牌)' + and ProjectType = '公寓' + ) E --朝向修正 + on A.clean_toward = E.SingleKey + left join + ( + select SingleKey, Coefficient, Elevator, UpperKey, LowerKey + from obpm_LianCheng_Data.dbo.DIM_PARAMETERS + where CoffType = '楼层(链家挂牌)' + and ProjectType = '公寓' + ) F --楼层修正 + on isnull(A.clean_Elevator, 99) = isnull(F.Elevator, 99) + and A.clean_total_floor = F.UpperKey + and A.clean_current_floor_desc = F.LowerKey + left join + ( + select SingleKey, Coefficient + from obpm_LianCheng_Data.dbo.DIM_PARAMETERS + where CoffType = '室内装修(链家挂牌)' + and ProjectType = '公寓' + ) G --装修修正 + on A.clean_Decoration = G.SingleKey + left join + ( + select SingleKey, Coefficient + from obpm_LianCheng_Data.dbo.DIM_PARAMETERS + where CoffType = '竣工日期' + and ProjectType = '公寓' + ) H --竣工日期修正 + on A.clean_year = H.SingleKey + left join obpm_LianCheng_Data.dbo.DIM_BUILDING_COFF I + on B.ITEM_BuildingID = I.BuildingID; + +----建临时表#HousingCaseListAdj, 插入挂牌清洗数据 +------ 20200312BUG修复:朝向处理规则优化 +create table #HousingCaseListAdj +( + case_id varchar(32) not null + , HouseholdsID_LJ bigint + , ProjectID_LJ bigint + , Roomtype nvarchar(64) + , Area decimal(18, 2) + , Towards nvarchar(64) + , UpperFloorSum nvarchar(32) + , UpperFloorNum nvarchar(32) + , Elevator tinyint + , Decoration nvarchar(64) + , [Year] int + , PriceTotal decimal(18, 2) + , PriceUnit decimal(18, 2) not null + , Visited_Num int + , First_Visit_Time date + , Visited_Num_15 int + , Visited_Num_30 int +); + +insert into #HousingCaseListAdj +( + case_id + , HouseholdsID_LJ + , ProjectID_LJ + , Roomtype + , Area + , Towards + , UpperFloorSum + , UpperFloorNum + , Elevator + , Decoration + , Year + , PriceTotal + , PriceUnit +) +select case_id + , case_lianjia_id + , case_lianjia_community_id + , case_apartment_layout + , case_area + , clean_toward + , clean_total_floor + , clean_current_floor_desc + , clean_elevator + , clean_decoration + , clean_year + , clean_total_price + , clean_unit_price +from original_residence_sale_opening_case_#yearMonth#; + +----案例标准化 +create table #HousingCaseListSTD +( + case_id varchar(32) not null + , HouseholdsID_LJ bigint + , ProjectID_LJ bigint + , ProjectID bigint + , BuildingID bigint + , AreaCoff decimal(7, 4) + , TowardsCoff decimal(7, 4) + , FloorCoff decimal(7, 4) + , DecorationRng int + , YearCoff decimal(7, 4) + , BuildingCoff decimal(7, 4) + , PriceUnit decimal(18, 2) not null + , PriceUnitAdj decimal(18, 2) not null +); +insert into #HousingCaseListSTD +( + case_id + , HouseholdsID_LJ + , ProjectID_LJ + , ProjectID + , BuildingID + , AreaCoff + , TowardsCoff + , FloorCoff + , DecorationRng + , YearCoff + , BuildingCoff + , PriceUnit + , PriceUnitAdj +) +select case_id + , case_lianjia_id + , case_lianjia_community_id + , uv_community_id + , uv_building_id + , area_coefficient + , toward_coefficient + , floor_coefficient + , decoration_coefficient + , year_coefficient + , building_coefficient + , clean_unit_price + , adjust_unit_price +from dbo.original_residence_sale_opening_case_#yearMonth#; + + +--当月拍照表调价信息 +--- 20200205BUG修复:AdjustedValue、AdjustedPst 中当Status=1时,值不为0的问题 +select +a.case_id, +a.HouseholdsID_LJ, + case when b.Status is null then 3 + when a.PriceTotal=b.PriceTotal then 1 + else 2 end as Status, +case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改 + when b.Status is null then 0 + else a.PriceTotal-b.PriceTotal end AdjustedValue, +case when a.PriceTotal=b.PriceTotal then 0 -- 20200205修改 + when b.Status is null then 0 + else (a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotal end AdjustedPst, +case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValue + when b.Status is null then 0 + else b.AdjustedCumValue + a.PriceTotal-b.PriceTotal end AdjustedCumValue, +case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPst + when b.Status is null then 0 + else (b.AdjustedCumValue + a.PriceTotal-b.PriceTotal)*1.0/b.PriceTotalIn end AdjustedCumPst, +case when a.PriceTotal=b.PriceTotal then b.AdjustedCumValueAbs + when b.Status is null then 0 + else b.AdjustedCumValueAbs + abs(a.PriceTotal-b.PriceTotal) end AdjustedCumValueAbs, +case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs + when b.Status is null then 0 + else (b.AdjustedCumValueAbs+ abs(a.PriceTotal-b.PriceTotal))*1.0/b.PriceTotalIn end AdjustedCumPstAbs, +case when a.PriceTotal=b.PriceTotal then b.AdjustedCumPstAbs + when b.Status is null then 0 + else b.AdjustedCumNum+1 end AdjustedCumNum, +case when b.Status is null then a.PriceTotal else b.PriceTotalIn end PriceTotalIn, +NULL as PriceTotalOut, +case when b.Status is null then getdate() else b.PriceDateIn end PriceDateIn, +cast(NULL as date) as PriceDateOut +into #HousingCaseListStatic +from #HousingCaseListAdj a +left join Ods_HousingCaseListed_LJ_#lastYearMonth# b +on a.HouseholdsID_LJ = b.HouseholdsID_LJ + + +--插入当月未下架(活跃)案例数据 +insert into dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth# +( + case_id + , HouseholdsID_LJ + , ProjectID_LJ + , ProjectID + , Roomtype + , Area + , Towards + , UpperFloorSum + , UpperFloorNum + , Elevator + , Decoration + , Year + , AreaCoff + , TowardsCoff + , FloorCoff + , DecorationRng + , YearCoff + , BuildingCoff + , PriceTotal + , PriceUnit + , PriceUnitAdj + , Visited_Num + , First_Visit_Time + , Visited_Num_15 + , Visited_Num_30 + , Status + , AdjustedValue + , AdjustedPst + , AdjustedCumValue + , AdjustedCumPst + , AdjustedCumValueAbs + , AdjustedCumPstAbs + , AdjustedCumNum + , PriceTotalIn + , PriceTotalOut + , PriceDateIn + , PriceDateOut +) +select a.case_id + , a.HouseholdsID_LJ + , a.ProjectID_LJ + , d.ProjectID + , a.Roomtype + , a.Area + , a.Towards + , a.UpperFloorSum + , a.UpperFloorNum + , a.Elevator + , a.Decoration + , a.[Year] + , b.AreaCoff + , b.TowardsCoff + , b.FloorCoff + , b.DecorationRng + , b.YearCoff + , b.BuildingCoff + , a.PriceTotal + , a.PriceUnit + , b.PriceUnitAdj + , a.Visited_Num + , a.First_Visit_Time + , a.Visited_Num_15 + , a.Visited_Num_30 + , c.Status + , c.AdjustedValue + , c.AdjustedPst + , c.AdjustedCumValue + , c.AdjustedCumPst + , c.AdjustedCumValueAbs + , c.AdjustedCumPstAbs + , c.AdjustedCumNum + , c.PriceTotalIn + , c.PriceTotalOut + , c.PriceDateIn + , c.PriceDateOut +from #HousingCaseListAdj a + left join #HousingCaseListSTD b + on a.HouseholdsID_LJ = b.HouseholdsID_LJ + left join #HousingCaseListStatic c + on a.HouseholdsID_LJ = c.HouseholdsID_LJ + left join DIM_PROJECTID_LJ2AI d + on a.ProjectID_LJ = d.ProjectID_LJ; + + +/*插入当月下架记录*/ + +--当月拍照表比上月汇总表减少的记录,为下架记录,先放入临时表 #TmpRecordAdd,然后插入到当月拍照表,记为当月汇总表 +insert into dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth# +( + case_id + , HouseholdsID_LJ + , ProjectID_LJ + , ProjectID + , Roomtype + , Area + , Towards + , UpperFloorSum + , UpperFloorNum + , Elevator + , Decoration + , Year + , AreaCoff + , TowardsCoff + , FloorCoff + , DecorationRng + , YearCoff + , BuildingCoff + , PriceTotal + , PriceUnit + , PriceUnitAdj + , Visited_Num + , First_Visit_Time + , Visited_Num_15 + , Visited_Num_30 + , Status + , AdjustedValue + , AdjustedPst + , AdjustedCumValue + , AdjustedCumPst + , AdjustedCumValueAbs + , AdjustedCumPstAbs + , AdjustedCumNum + , PriceTotalIn + , PriceTotalOut + , PriceDateIn + , PriceDateOut +) +select a.case_id + , a.HouseholdsID_LJ + , a.ProjectID_LJ + , a.ProjectID + , a.Roomtype + , a.Area + , a.Towards + , a.UpperFloorSum + , a.UpperFloorNum + , a.Elevator + , a.Decoration + , a.[Year] + , a.AreaCoff + , a.TowardsCoff + , a.FloorCoff + , a.DecorationRng + , a.YearCoff + , a.BuildingCoff + , a.PriceTotal + , a.PriceUnit + , a.PriceUnitAdj + , a.Visited_Num + , a.First_Visit_Time + , a.Visited_Num_15 + , a.Visited_Num_30 + , 4 as Status + , a.AdjustedValue + , a.AdjustedPst + , a.AdjustedCumValue + , a.AdjustedCumPst + , a.AdjustedCumValueAbs + , a.AdjustedCumPstAbs + , a.AdjustedCumNum + , a.PriceTotalIn + , a.PriceTotal as PriceTotalOut + , a.PriceDateIn + , getdate() as PriceDateOut +from ODS_HOUSINGCASELISTED_LJ_#lastYearMonth# a + left join ODS_HOUSINGCASELISTED_LJ_#yearMonth# b + on a.HouseholdsID_LJ = b.HouseholdsID_LJ +where b.HouseholdsID_LJ is null + and a.Status not in ( 4, 5 ); + + +/*插入历史下架记录*/ +insert into dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth# +( + case_id + , HouseholdsID_LJ + , ProjectID_LJ + , ProjectID + , Roomtype + , Area + , Towards + , UpperFloorSum + , UpperFloorNum + , Elevator + , Decoration + , Year + , AreaCoff + , TowardsCoff + , FloorCoff + , DecorationRng + , YearCoff + , BuildingCoff + , PriceTotal + , PriceUnit + , PriceUnitAdj + , Visited_Num + , First_Visit_Time + , Visited_Num_15 + , Visited_Num_30 + , Status + , AdjustedValue + , AdjustedPst + , AdjustedCumValue + , AdjustedCumPst + , AdjustedCumValueAbs + , AdjustedCumPstAbs + , AdjustedCumNum + , PriceTotalIn + , PriceTotalOut + , PriceDateIn + , PriceDateOut +) +select a.case_id + , a.HouseholdsID_LJ + , a.ProjectID_LJ + , a.ProjectID + , a.Roomtype + , a.Area + , a.Towards + , a.UpperFloorSum + , a.UpperFloorNum + , a.Elevator + , a.Decoration + , a.[Year] + , a.AreaCoff + , a.TowardsCoff + , a.FloorCoff + , a.DecorationRng + , a.YearCoff + , a.BuildingCoff + , a.PriceTotal + , a.PriceUnit + , a.PriceUnitAdj + , a.Visited_Num + , a.First_Visit_Time + , a.Visited_Num_15 + , a.Visited_Num_30 + , 5 as Status + , a.AdjustedValue + , a.AdjustedPst + , a.AdjustedCumValue + , a.AdjustedCumPst + , a.AdjustedCumValueAbs + , a.AdjustedCumPstAbs + , a.AdjustedCumNum + , a.PriceTotalIn + , a.PriceTotal as PriceTotalOut + , a.PriceDateIn + , a.PriceDateOut +from ODS_HOUSINGCASELISTED_LJ_#lastYearMonth# a + left join ODS_HOUSINGCASELISTED_LJ_#yearMonth# b + on a.HouseholdsID_LJ = b.HouseholdsID_LJ +where b.HouseholdsID_LJ is null + and a.Status in ( 4, 5 ); + +drop table #HousingCaseListAdj +drop table #HousingCaseListSTD +drop table #HousingCaseListStatic \ No newline at end of file diff --git a/ruoyi/src/test/java/com/uvaluation/compute/MapperXmlGeneratorTests.java b/ruoyi/src/test/java/com/uvaluation/compute/MapperXmlGeneratorTests.java index 9e4332e32..6892a87a8 100644 --- a/ruoyi/src/test/java/com/uvaluation/compute/MapperXmlGeneratorTests.java +++ b/ruoyi/src/test/java/com/uvaluation/compute/MapperXmlGeneratorTests.java @@ -37,4 +37,13 @@ public class MapperXmlGeneratorTests { calendar.get(Calendar.MONTH)-1)); Assert.assertTrue(Objects.equals(lastYearMonth,202005)); } + + @Test + public void testDemo(){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH) + 1)); + System.out.println(computeTableRoute); + } } diff --git a/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java b/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java new file mode 100644 index 000000000..8a7d73d14 --- /dev/null +++ b/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java @@ -0,0 +1,32 @@ +package com.uvaluation.compute; + +import com.ruoyi.RuoYiApplication; +import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService; +import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RuoYiApplication.class) +public class ResidenceSaleBasePriceTests { + + @Autowired + private IOriginalResidenceSaleOpeningCaseService originalResidenceOpeningCaseService; + @Autowired + private IOriginalResidenceSaleClosingCaseService originalResidenceClosingCaseService; + + @Test + public void testClearOpeningCase() { + originalResidenceOpeningCaseService.pullData(); + } + + @Test + public void testClearClosingCase() { + originalResidenceClosingCaseService.pullData(); + } + + +}