diff --git a/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js b/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js new file mode 100644 index 000000000..23df93289 --- /dev/null +++ b/ruoyi-ui/src/api/data/artificialResidenceSalePrice.js @@ -0,0 +1,43 @@ +import request from '@/utils/request' + +// 查询住宅销售基价修正列表 +export function list(query) { + return request({ + url: '/data/price/residence/sale/artificial/list', + method: 'get', + params: query + }) +} + +// 查询住宅销售基价修正详细 +export function get(id) { + return request({ + url: '/data/price/residence/sale/artificial/' + id, + method: 'get' + }) +} + +// 修改住宅销售基价修正 +export function update(data) { + return request({ + url: '/data/price/residence/sale/artificial', + method: 'put', + data: data + }) +} + +// 导出住宅销售基价修正 +export function export2File(query) { + return request({ + url: '/data/price/residence/sale/artificial/export', + method: 'get', + params: query + }) +} + +export function getYearMonthList() { + return request({ + url: '/data/price/residence/sale/artificial/yearmonth', + method: 'get' + }) +} diff --git a/ruoyi-ui/src/api/data/computeResidenceSalePrice.js b/ruoyi-ui/src/api/data/computeResidenceSalePrice.js new file mode 100644 index 000000000..1cd74f92b --- /dev/null +++ b/ruoyi-ui/src/api/data/computeResidenceSalePrice.js @@ -0,0 +1,43 @@ +import request from '@/utils/request' + +// 查询住宅销售基价列表 +export function list(query) { + return request({ + url: '/data/price/residence/sale/compute/list', + method: 'get', + params: query + }) +} + +// 查询住宅销售基价详细 +export function get(id) { + return request({ + url: '/data/price/residence/sale/compute/' + id, + method: 'get' + }) +} + +// 修改住宅销售基价 +export function update(data) { + return request({ + url: '/data/price/residence/sale/compute', + method: 'put', + data: data + }) +} + +// 导出住宅销售基价 +export function export2File(query) { + return request({ + url: '/data/price/residence/sale/compute/export', + method: 'get', + params: query + }) +} + +export function getYearMonthList() { + return request({ + url: '/data/price/residence/sale/compute/yearmonth', + method: 'get' + }) +} diff --git a/ruoyi-ui/src/views/data/price/ArtificialResidenceSalePrice.vue b/ruoyi-ui/src/views/data/price/ArtificialResidenceSalePrice.vue new file mode 100644 index 000000000..7e6646070 --- /dev/null +++ b/ruoyi-ui/src/views/data/price/ArtificialResidenceSalePrice.vue @@ -0,0 +1,479 @@ + + + diff --git a/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue b/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue new file mode 100644 index 000000000..9d42a4245 --- /dev/null +++ b/ruoyi-ui/src/views/data/price/ComputeResidenceSalePrice.vue @@ -0,0 +1,380 @@ + + + diff --git a/ruoyi/pom.xml b/ruoyi/pom.xml index 81ac0aa3b..8f7ca1dbe 100644 --- a/ruoyi/pom.xml +++ b/ruoyi/pom.xml @@ -98,7 +98,7 @@ com.microsoft.sqlserver mssql-jdbc - runtime + 7.4.0.jre8 diff --git a/ruoyi/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index f0ab5e7d1..14987f8b5 100644 --- a/ruoyi/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -16,6 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; + import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.Cell; @@ -53,11 +54,10 @@ import com.ruoyi.common.utils.reflect.ReflectUtils; /** * Excel相关处理 - * + * * @author ruoyi */ -public class ExcelUtil -{ +public class ExcelUtil { private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); /** @@ -105,15 +105,12 @@ public class ExcelUtil */ public Class clazz; - public ExcelUtil(Class clazz) - { + public ExcelUtil(Class clazz) { this.clazz = clazz; } - public void init(List list, String sheetName, Type type) - { - if (list == null) - { + public void init(List list, String sheetName, Type type) { + if (list == null) { list = new ArrayList(); } this.list = list; @@ -125,62 +122,51 @@ public class ExcelUtil /** * 对excel表单默认第一个索引名转换成list - * + * * @param is 输入流 * @return 转换后集合 */ - public List importExcel(InputStream is) throws Exception - { + public List importExcel(InputStream is) throws Exception { return importExcel(StringUtils.EMPTY, is); } /** * 对excel表单指定表格索引名转换成list - * + * * @param sheetName 表格索引名 - * @param is 输入流 + * @param is 输入流 * @return 转换后集合 */ - public List importExcel(String sheetName, InputStream is) throws Exception - { + public List importExcel(String sheetName, InputStream is) throws Exception { this.type = Type.IMPORT; this.wb = WorkbookFactory.create(is); List list = new ArrayList(); Sheet sheet = null; - if (StringUtils.isNotEmpty(sheetName)) - { + if (StringUtils.isNotEmpty(sheetName)) { // 如果指定sheet名,则取指定sheet中的内容. sheet = wb.getSheet(sheetName); - } - else - { + } else { // 如果传入的sheet名不存在则默认指向第1个sheet. sheet = wb.getSheetAt(0); } - if (sheet == null) - { + if (sheet == null) { throw new IOException("文件sheet不存在"); } int rows = sheet.getPhysicalNumberOfRows(); - if (rows > 0) - { + if (rows > 0) { // 定义一个map用于存放excel列的序号和field. Map cellMap = new HashMap(); // 获取表头 Row heard = sheet.getRow(0); - for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) - { + for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) { Cell cell = heard.getCell(i); - if (StringUtils.isNotNull(cell)) - { + if (StringUtils.isNotNull(cell)) { String value = this.getCellValue(heard, i).toString(); cellMap.put(value, i); - } - else - { + } else { cellMap.put(null, i); } } @@ -188,25 +174,21 @@ public class ExcelUtil Field[] allFields = clazz.getDeclaredFields(); // 定义一个map用于存放列的序号和field. Map fieldsMap = new HashMap(); - for (int col = 0; col < allFields.length; col++) - { + for (int col = 0; col < allFields.length; col++) { Field field = allFields[col]; Excel attr = field.getAnnotation(Excel.class); - if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) - { + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) { // 设置类的私有字段属性可访问. field.setAccessible(true); Integer column = cellMap.get(attr.name()); fieldsMap.put(column, field); } } - for (int i = 1; i < rows; i++) - { + for (int i = 1; i < rows; i++) { // 从第2行开始取数据,默认第一行是表头. Row row = sheet.getRow(i); T entity = null; - for (Map.Entry entry : fieldsMap.entrySet()) - { + for (Map.Entry entry : fieldsMap.entrySet()) { Object val = this.getCellValue(row, entry.getKey()); // 如果不存在实例则新建. @@ -215,59 +197,36 @@ public class ExcelUtil Field field = fieldsMap.get(entry.getKey()); // 取得类型,并根据对象类型设置值. Class fieldType = field.getType(); - if (String.class == fieldType) - { + if (String.class == fieldType) { String s = Convert.toStr(val); - if (StringUtils.endsWith(s, ".0")) - { + if (StringUtils.endsWith(s, ".0")) { val = StringUtils.substringBefore(s, ".0"); - } - else - { + } else { val = Convert.toStr(val); } - } - else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType)) - { + } else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType)) { val = Convert.toInt(val); - } - else if ((Long.TYPE == fieldType) || (Long.class == fieldType)) - { + } else if ((Long.TYPE == fieldType) || (Long.class == fieldType)) { val = Convert.toLong(val); - } - else if ((Double.TYPE == fieldType) || (Double.class == fieldType)) - { + } else if ((Double.TYPE == fieldType) || (Double.class == fieldType)) { val = Convert.toDouble(val); - } - else if ((Float.TYPE == fieldType) || (Float.class == fieldType)) - { + } else if ((Float.TYPE == fieldType) || (Float.class == fieldType)) { val = Convert.toFloat(val); - } - else if (BigDecimal.class == fieldType) - { + } else if (BigDecimal.class == fieldType) { val = Convert.toBigDecimal(val); - } - else if (Date.class == fieldType) - { - if (val instanceof String) - { + } else if (Date.class == fieldType) { + if (val instanceof String) { val = DateUtils.parseDate(val); - } - else if (val instanceof Double) - { + } else if (val instanceof Double) { val = DateUtil.getJavaDate((Double) val); } } - if (StringUtils.isNotNull(fieldType)) - { + if (StringUtils.isNotNull(fieldType)) { Excel attr = field.getAnnotation(Excel.class); String propertyName = field.getName(); - if (StringUtils.isNotEmpty(attr.targetAttr())) - { + if (StringUtils.isNotEmpty(attr.targetAttr())) { propertyName = field.getName() + "." + attr.targetAttr(); - } - else if (StringUtils.isNotEmpty(attr.readConverterExp())) - { + } else if (StringUtils.isNotEmpty(attr.readConverterExp())) { val = reverseByExp(String.valueOf(val), attr.readConverterExp()); } ReflectUtils.invokeSetter(entity, propertyName, val); @@ -281,56 +240,49 @@ public class ExcelUtil /** * 对list数据源将其里面的数据导入到excel表单 - * - * @param list 导出数据集合 + * + * @param list 导出数据集合 * @param sheetName 工作表的名称 * @return 结果 */ - public AjaxResult exportExcel(List list, String sheetName) - { + public AjaxResult exportExcel(List list, String sheetName) { this.init(list, sheetName, Type.EXPORT); return exportExcel(); } /** * 对list数据源将其里面的数据导入到excel表单 - * + * * @param sheetName 工作表的名称 * @return 结果 */ - public AjaxResult importTemplateExcel(String sheetName) - { + public AjaxResult importTemplateExcel(String sheetName) { this.init(null, sheetName, Type.IMPORT); return exportExcel(); } /** * 对list数据源将其里面的数据导入到excel表单 - * + * * @return 结果 */ - public AjaxResult exportExcel() - { + public AjaxResult exportExcel() { OutputStream out = null; - try - { + try { // 取出一共有多少个sheet. double sheetNo = Math.ceil(list.size() / sheetSize); - for (int index = 0; index <= sheetNo; index++) - { + for (int index = 0; index <= sheetNo; index++) { createSheet(sheetNo, index); // 产生一行 Row row = sheet.createRow(0); int column = 0; // 写入各个字段的列头名称 - for (Object[] os : fields) - { + for (Object[] os : fields) { Excel excel = (Excel) os[1]; this.createCell(excel, row, column++); } - if (Type.EXPORT.equals(type)) - { + if (Type.EXPORT.equals(type)) { fillExcelData(index, row); } } @@ -338,33 +290,21 @@ public class ExcelUtil out = new FileOutputStream(getAbsoluteFile(filename)); wb.write(out); return AjaxResult.success(filename); - } - catch (Exception e) - { + } catch (Exception e) { log.error("导出Excel异常{}", e.getMessage()); throw new CustomException("导出Excel失败,请联系网站管理员!"); - } - finally - { - if (wb != null) - { - try - { + } finally { + if (wb != null) { + try { wb.close(); - } - catch (IOException e1) - { + } catch (IOException e1) { e1.printStackTrace(); } } - if (out != null) - { - try - { + if (out != null) { + try { out.close(); - } - catch (IOException e1) - { + } catch (IOException e1) { e1.printStackTrace(); } } @@ -373,22 +313,19 @@ public class ExcelUtil /** * 填充excel数据 - * + * * @param index 序号 - * @param row 单元格行 + * @param row 单元格行 */ - public void fillExcelData(int index, Row row) - { + public void fillExcelData(int index, Row row) { int startNo = index * sheetSize; int endNo = Math.min(startNo + sheetSize, list.size()); - for (int i = startNo; i < endNo; i++) - { + for (int i = startNo; i < endNo; i++) { row = sheet.createRow(i + 1 - startNo); // 得到导出对象. T vo = (T) list.get(i); int column = 0; - for (Object[] os : fields) - { + for (Object[] os : fields) { Field field = (Field) os[0]; Excel excel = (Excel) os[1]; // 设置实体类私有属性可访问 @@ -400,12 +337,11 @@ public class ExcelUtil /** * 创建表格样式 - * + * * @param wb 工作薄对象 * @return 样式列表 */ - private Map createStyles(Workbook wb) - { + private Map createStyles(Workbook wb) { // 写入各条记录,每条记录对应excel表中的一行 Map styles = new HashMap(); CellStyle style = wb.createCellStyle(); @@ -445,8 +381,7 @@ public class ExcelUtil /** * 创建单元格 */ - public Cell createCell(Excel attr, Row row, int column) - { + public Cell createCell(Excel attr, Row row, int column) { // 创建列 Cell cell = row.createCell(column); // 写入列信息 @@ -458,20 +393,16 @@ public class ExcelUtil /** * 设置单元格信息 - * + * * @param value 单元格值 - * @param attr 注解相关 - * @param cell 单元格信息 + * @param attr 注解相关 + * @param cell 单元格信息 */ - public void setCellVo(Object value, Excel attr, Cell cell) - { - if (ColumnType.STRING == attr.cellType()) - { + public void setCellVo(Object value, Excel attr, Cell cell) { + if (ColumnType.STRING == attr.cellType()) { cell.setCellType(CellType.NUMERIC); cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix()); - } - else if (ColumnType.NUMERIC == attr.cellType()) - { + } else if (ColumnType.NUMERIC == attr.cellType()) { cell.setCellType(CellType.NUMERIC); cell.setCellValue(Integer.parseInt(value + "")); } @@ -480,27 +411,21 @@ public class ExcelUtil /** * 创建表格样式 */ - public void setDataValidation(Excel attr, Row row, int column) - { - if (attr.name().indexOf("注:") >= 0) - { + public void setDataValidation(Excel attr, Row row, int column) { + if (attr.name().indexOf("注:") >= 0) { sheet.setColumnWidth(column, 6000); - } - else - { + } else { // 设置列宽 sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); row.setHeight((short) (attr.height() * 20)); } // 如果设置了提示信息则鼠标放上去提示. - if (StringUtils.isNotEmpty(attr.prompt())) - { + if (StringUtils.isNotEmpty(attr.prompt())) { // 这里默认设了2-101列提示. setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column); } // 如果设置了combo属性则本列只能选择不能输入 - if (attr.combo().length > 0) - { + if (attr.combo().length > 0) { // 这里默认设了2-101列只能选择不能输入. setXSSFValidation(sheet, attr.combo(), 1, 100, column, column); } @@ -509,16 +434,13 @@ public class ExcelUtil /** * 添加单元格 */ - public Cell addCell(Excel attr, Row row, T vo, Field field, int column) - { + public Cell addCell(Excel attr, Row row, T vo, Field field, int column) { Cell cell = null; - try - { + try { // 设置行高 row.setHeight((short) (attr.height() * 20)); // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. - if (attr.isExport()) - { + if (attr.isExport()) { // 创建cell cell = row.createCell(column); cell.setCellStyle(styles.get("data")); @@ -527,23 +449,16 @@ public class ExcelUtil Object value = getTargetValue(vo, field, attr); String dateFormat = attr.dateFormat(); String readConverterExp = attr.readConverterExp(); - if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) - { + if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) { cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value)); - } - else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) - { + } else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) { cell.setCellValue(convertByExp(String.valueOf(value), readConverterExp)); - } - else - { + } else { // 设置列类型 setCellVo(value, attr, cell); } } - } - catch (Exception e) - { + } catch (Exception e) { log.error("导出Excel失败{}", e); } return cell; @@ -551,18 +466,17 @@ public class ExcelUtil /** * 设置 POI XSSFSheet 单元格提示 - * - * @param sheet 表单 - * @param promptTitle 提示标题 + * + * @param sheet 表单 + * @param promptTitle 提示标题 * @param promptContent 提示内容 - * @param firstRow 开始行 - * @param endRow 结束行 - * @param firstCol 开始列 - * @param endCol 结束列 + * @param firstRow 开始行 + * @param endRow 结束行 + * @param firstCol 开始列 + * @param endCol 结束列 */ public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow, - int firstCol, int endCol) - { + int firstCol, int endCol) { DataValidationHelper helper = sheet.getDataValidationHelper(); DataValidationConstraint constraint = helper.createCustomConstraint("DD1"); CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); @@ -574,17 +488,16 @@ public class ExcelUtil /** * 设置某些列的值只能输入预制的数据,显示下拉框. - * - * @param sheet 要设置的sheet. + * + * @param sheet 要设置的sheet. * @param textlist 下拉框显示的内容 * @param firstRow 开始行 - * @param endRow 结束行 + * @param endRow 结束行 * @param firstCol 开始列 - * @param endCol 结束列 + * @param endCol 结束列 * @return 设置好的sheet. */ - public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) - { + public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) { DataValidationHelper helper = sheet.getDataValidationHelper(); // 加载下拉列表内容 DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist); @@ -593,13 +506,10 @@ public class ExcelUtil // 数据有效性对象 DataValidation dataValidation = helper.createValidation(constraint, regions); // 处理Excel兼容性问题 - if (dataValidation instanceof XSSFDataValidation) - { + if (dataValidation instanceof XSSFDataValidation) { dataValidation.setSuppressDropDownArrow(true); dataValidation.setShowErrorBox(true); - } - else - { + } else { dataValidation.setSuppressDropDownArrow(false); } @@ -608,28 +518,22 @@ public class ExcelUtil /** * 解析导出值 0=男,1=女,2=未知 - * + * * @param propertyValue 参数值 - * @param converterExp 翻译注解 + * @param converterExp 翻译注解 * @return 解析后值 * @throws Exception */ - public static String convertByExp(String propertyValue, String converterExp) throws Exception - { - try - { + public static String convertByExp(String propertyValue, String converterExp) throws Exception { + try { String[] convertSource = converterExp.split(","); - for (String item : convertSource) - { + for (String item : convertSource) { String[] itemArray = item.split("="); - if (itemArray[0].equals(propertyValue)) - { + if (itemArray[0].equals(propertyValue)) { return itemArray[1]; } } - } - catch (Exception e) - { + } catch (Exception e) { throw e; } return propertyValue; @@ -637,28 +541,22 @@ public class ExcelUtil /** * 反向解析值 男=0,女=1,未知=2 - * + * * @param propertyValue 参数值 - * @param converterExp 翻译注解 + * @param converterExp 翻译注解 * @return 解析后值 * @throws Exception */ - public static String reverseByExp(String propertyValue, String converterExp) throws Exception - { - try - { + public static String reverseByExp(String propertyValue, String converterExp) throws Exception { + try { String[] convertSource = converterExp.split(","); - for (String item : convertSource) - { + for (String item : convertSource) { String[] itemArray = item.split("="); - if (itemArray[1].equals(propertyValue)) - { + if (itemArray[1].equals(propertyValue)) { return itemArray[0]; } } - } - catch (Exception e) - { + } catch (Exception e) { throw e; } return propertyValue; @@ -667,23 +565,20 @@ public class ExcelUtil /** * 编码文件名 */ - public String encodingFilename(String filename) - { - filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; + public String encodingFilename(String filename) { + filename = filename + "_" + UUID.randomUUID().toString() + ".xlsx"; return filename; } /** * 获取下载路径 - * + * * @param filename 文件名称 */ - public String getAbsoluteFile(String filename) - { + public String getAbsoluteFile(String filename) { String downloadPath = RuoYiConfig.getDownloadPath() + filename; File desc = new File(downloadPath); - if (!desc.getParentFile().exists()) - { + if (!desc.getParentFile().exists()) { desc.getParentFile().mkdirs(); } return downloadPath; @@ -691,29 +586,23 @@ public class ExcelUtil /** * 获取bean中的属性值 - * - * @param vo 实体对象 + * + * @param vo 实体对象 * @param field 字段 * @param excel 注解 * @return 最终的属性值 * @throws Exception */ - private Object getTargetValue(T vo, Field field, Excel excel) throws Exception - { + private Object getTargetValue(T vo, Field field, Excel excel) throws Exception { Object o = field.get(vo); - if (StringUtils.isNotEmpty(excel.targetAttr())) - { + if (StringUtils.isNotEmpty(excel.targetAttr())) { String target = excel.targetAttr(); - if (target.indexOf(".") > -1) - { + if (target.indexOf(".") > -1) { String[] targets = target.split("[.]"); - for (String name : targets) - { + for (String name : targets) { o = getValue(o, name); } - } - else - { + } else { o = getValue(o, target); } } @@ -722,16 +611,14 @@ public class ExcelUtil /** * 以类的属性的get方法方法形式获取值 - * + * * @param o * @param name * @return value * @throws Exception */ - private Object getValue(Object o, String name) throws Exception - { - if (StringUtils.isNotEmpty(name)) - { + private Object getValue(Object o, String name) throws Exception { + if (StringUtils.isNotEmpty(name)) { Class clazz = o.getClass(); String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); Method method = clazz.getMethod(methodName); @@ -743,27 +630,22 @@ public class ExcelUtil /** * 得到所有定义字段 */ - private void createExcelField() - { + private void createExcelField() { this.fields = new ArrayList(); List tempFields = new ArrayList<>(); tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); - for (Field field : tempFields) - { + for (Field field : tempFields) { // 单注解 - if (field.isAnnotationPresent(Excel.class)) - { + if (field.isAnnotationPresent(Excel.class)) { putToField(field, field.getAnnotation(Excel.class)); } // 多注解 - if (field.isAnnotationPresent(Excels.class)) - { + if (field.isAnnotationPresent(Excels.class)) { Excels attrs = field.getAnnotation(Excels.class); Excel[] excels = attrs.value(); - for (Excel excel : excels) - { + for (Excel excel : excels) { putToField(field, excel); } } @@ -773,98 +655,72 @@ public class ExcelUtil /** * 放到字段集合中 */ - private void putToField(Field field, Excel attr) - { - if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) - { - this.fields.add(new Object[] { field, attr }); + private void putToField(Field field, Excel attr) { + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) { + this.fields.add(new Object[]{field, attr}); } } /** * 创建一个工作簿 */ - public void createWorkbook() - { + public void createWorkbook() { this.wb = new SXSSFWorkbook(500); } /** * 创建工作表 - * + * * @param sheetNo sheet数量 - * @param index 序号 + * @param index 序号 */ - public void createSheet(double sheetNo, int index) - { + public void createSheet(double sheetNo, int index) { this.sheet = wb.createSheet(); this.styles = createStyles(wb); // 设置工作表的名称. - if (sheetNo == 0) - { + if (sheetNo == 0) { wb.setSheetName(index, sheetName); - } - else - { + } else { wb.setSheetName(index, sheetName + index); } } /** * 获取单元格值 - * - * @param row 获取的行 + * + * @param row 获取的行 * @param column 获取单元格列号 * @return 单元格值 */ - public Object getCellValue(Row row, int column) - { - if (row == null) - { + public Object getCellValue(Row row, int column) { + if (row == null) { return row; } Object val = ""; - try - { + try { Cell cell = row.getCell(column); - if (StringUtils.isNotNull(cell)) - { - if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) - { + if (StringUtils.isNotNull(cell)) { + if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) { val = cell.getNumericCellValue(); - if (HSSFDateUtil.isCellDateFormatted(cell)) - { + if (HSSFDateUtil.isCellDateFormatted(cell)) { val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 - } - else - { - if ((Double) val % 1 > 0) - { + } else { + if ((Double) val % 1 > 0) { val = new DecimalFormat("0.00").format(val); - } - else - { + } else { val = new DecimalFormat("0").format(val); } } - } - else if (cell.getCellTypeEnum() == CellType.STRING) - { + } else if (cell.getCellTypeEnum() == CellType.STRING) { val = cell.getStringCellValue(); - } - else if (cell.getCellTypeEnum() == CellType.BOOLEAN) - { + } else if (cell.getCellTypeEnum() == CellType.BOOLEAN) { val = cell.getBooleanCellValue(); - } - else if (cell.getCellTypeEnum() == CellType.ERROR) - { + } else if (cell.getCellTypeEnum() == CellType.ERROR) { val = cell.getErrorCellValue(); } } - } - catch (Exception e) - { + } catch (Exception e) { return val; } return val; diff --git a/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java b/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java index b59fb29c0..4b66a26bf 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java @@ -1,109 +1,109 @@ -package com.ruoyi.project.common; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileUploadUtils; -import com.ruoyi.common.utils.file.FileUtils; -import com.ruoyi.framework.config.RuoYiConfig; -import com.ruoyi.framework.config.ServerConfig; -import com.ruoyi.framework.web.domain.AjaxResult; - -/** - * 通用请求处理 - * - * @author ruoyi - */ -@RestController -public class CommonController -{ - private static final Logger log = LoggerFactory.getLogger(CommonController.class); - - @Autowired - private ServerConfig serverConfig; - - /** - * 通用下载请求 - * - * @param fileName 文件名称 - * @param delete 是否删除 - */ - @GetMapping("common/download") - public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) - { - try - { - if (!FileUtils.isValidFilename(fileName)) - { - throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); - } - String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); - String filePath = RuoYiConfig.getDownloadPath() + fileName; - - response.setCharacterEncoding("utf-8"); - response.setContentType("multipart/form-data"); - response.setHeader("Content-Disposition", - "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName)); - FileUtils.writeBytes(filePath, response.getOutputStream()); - if (delete) - { - FileUtils.deleteFile(filePath); - } - } - catch (Exception e) - { - log.error("下载文件失败", e); - } - } - - /** - * 通用上传请求 - */ - @PostMapping("/common/upload") - public AjaxResult uploadFile(MultipartFile file) throws Exception - { - try - { - // 上传文件路径 - String filePath = RuoYiConfig.getUploadPath(); - // 上传并返回新文件名称 - String fileName = FileUploadUtils.upload(filePath, file); - String url = serverConfig.getUrl() + fileName; - AjaxResult ajax = AjaxResult.success(); - ajax.put("fileName", fileName); - ajax.put("url", url); - return ajax; - } - catch (Exception e) - { - return AjaxResult.error(e.getMessage()); - } - } - - /** - * 本地资源通用下载 - */ - @GetMapping("/common/download/resource") - public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception - { - // 本地资源路径 - String localPath = RuoYiConfig.getProfile(); - // 数据库资源地址 - String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX); - // 下载名称 - String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); - response.setCharacterEncoding("utf-8"); - response.setContentType("multipart/form-data"); - response.setHeader("Content-Disposition", - "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName)); - FileUtils.writeBytes(downloadPath, response.getOutputStream()); - } -} +package com.ruoyi.project.common; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.RuoYiConfig; +import com.ruoyi.framework.config.ServerConfig; +import com.ruoyi.framework.web.domain.AjaxResult; + +/** + * 通用请求处理 + * + * @author ruoyi + */ +@RestController +public class CommonController +{ + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private ServerConfig serverConfig; + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + * @param delete 是否删除 + */ + @GetMapping("common/download") + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) + { + try + { + if (!FileUtils.isValidFilename(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = RuoYiConfig.getDownloadPath() + fileName; + + response.setCharacterEncoding("utf-8"); + response.setContentType("multipart/form-data"); + response.setHeader("Content-Disposition", + "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, fileName)); + FileUtils.writeBytes(filePath, response.getOutputStream()); + if (delete) + { + FileUtils.deleteFile(filePath); + } + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + /** + * 通用上传请求 + */ + @PostMapping("/common/upload") + public AjaxResult uploadFile(MultipartFile file) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("fileName", fileName); + ajax.put("url", url); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 本地资源通用下载 + */ + @GetMapping("/common/download/resource") + public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // 本地资源路径 + String localPath = RuoYiConfig.getProfile(); + // 数据库资源地址 + String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX); + // 下载名称 + String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); + response.setCharacterEncoding("utf-8"); + response.setContentType("multipart/form-data"); + response.setHeader("Content-Disposition", + "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName)); + FileUtils.writeBytes(downloadPath, response.getOutputStream()); + } +} 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 index e375b591a..7c64f25b0 100644 --- 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 @@ -33,6 +33,19 @@ public interface OriginalResidenceSaleOpeningCaseMapper { * @return */ int createAssembleTable(@Param("yearMonth") Integer yearMonth); + /** + * 作价表 + * @param yearMonth + * @return + */ + int createComputePriceTable(@Param("yearMonth") Integer yearMonth); + + /** + * 人工修正价格表 + * @param yearMonth + * @return + */ + int createArtificialPriceTable(@Param("yearMonth") Integer yearMonth); /** * 分页总数 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 index 35ce70311..8e08a0f99 100644 --- 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 @@ -102,7 +102,7 @@ public class OriginalResidenceSaleClosingCaseServiceImpl implements IOriginalRes */ public void after(Integer yearMonth) { // 清洗挂牌案例 - String rawSql = LoadUtil.loadContent("sql-template/clear_closing_case.sql"); + String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_closing_case.sql"); String sql = rawSql.replace("#yearMonth#", yearMonth.toString()); jdbcTemplate.update(sql); } 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 index 7c46df7ef..ff6481191 100644 --- 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 @@ -17,6 +17,7 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; +import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -50,6 +51,8 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes calendar.get(Calendar.MONTH))); Integer lastYearMonth = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1)); + calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1); + Date valuePoint = calendar.getTime(); calendar.add(Calendar.MONTH, 1); Integer computeTableRoute = new Integer(String.format("%d%02d", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1)); @@ -59,11 +62,10 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes list.parallelStream().forEach(originalResidenceOpeningCase -> { originalResidenceOpeningCase.clear(); originalResidenceOpeningCase.setYearMonth(syncTableRoute); -// logger.debug(originalResidenceOpeningCase.toString()); syncOriginalResidenceSaleOpeningCaseMapper.insert(originalResidenceOpeningCase); }); - running(computeTableRoute, syncTableRoute, list); - after(computeTableRoute, lastYearMonth); + running(computeTableRoute, list); + after(computeTableRoute, lastYearMonth, valuePoint); } /** @@ -75,6 +77,10 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes public void prepare(Integer computeTableRoute, Integer syncTableRoute) { originalResidenceSaleOpeningCaseMapper.createTable(computeTableRoute); originalResidenceSaleOpeningCaseMapper.createCleanTable(computeTableRoute); + originalResidenceSaleOpeningCaseMapper.createAssembleTable(computeTableRoute); + originalResidenceSaleOpeningCaseMapper.createComputePriceTable(computeTableRoute); + originalResidenceSaleOpeningCaseMapper.createArtificialPriceTable(computeTableRoute); + syncOriginalResidenceSaleOpeningCaseMapper.createTable(syncTableRoute); } @@ -84,7 +90,7 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes * @param computeTableRoute * @param list */ - public void running(Integer computeTableRoute, Integer syncTableRoute, List list) { + public void running(Integer computeTableRoute, 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, " + @@ -108,15 +114,27 @@ public class OriginalResidenceSaleOpeningCaseServiceImpl implements IOriginalRes /** * 匹配数据 + * 计算基价 * * @param yearMonth + * @param lastYearMonth + * @param valuePoint */ - public void after(Integer yearMonth, Integer lastYearMonth) { + public void after(Integer yearMonth, Integer lastYearMonth, Date valuePoint) { // 清洗挂牌案例 - String rawSql = LoadUtil.loadContent("sql-template/clear_opening_case.sql"); + String rawSql = LoadUtil.loadContent("sql-template/clear_residence_sale_opening_case.sql"); String sql = rawSql.replace("#yearMonth#", yearMonth.toString()) .replace("#lastYearMonth#", lastYearMonth.toString()); jdbcTemplate.update(sql); + // 作价 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + rawSql = LoadUtil.loadContent("sql-template/compute_residence_sale_base_price.sql"); + sql = rawSql.replace("#yearMonth#", yearMonth.toString()) + .replace("#lastYearMonth#", lastYearMonth.toString()) + .replace("#valuePoint#", simpleDateFormat.format(valuePoint)); + jdbcTemplate.update(sql); + + logger.debug("#作价完成#"); } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ArtificialOfficeBasePriceController.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ArtificialOfficeBasePriceController.java deleted file mode 100644 index 6bf035b3c..000000000 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ArtificialOfficeBasePriceController.java +++ /dev/null @@ -1,107 +0,0 @@ -//package com.ruoyi.project.data.price.controller; -// -//import com.ruoyi.common.utils.ServletUtils; -//import com.ruoyi.common.utils.poi.ExcelUtil; -//import com.ruoyi.framework.aspectj.lang.annotation.Log; -//import com.ruoyi.framework.aspectj.lang.enums.BusinessType; -//import com.ruoyi.framework.security.LoginUser; -//import com.ruoyi.framework.security.service.TokenService; -//import com.ruoyi.framework.web.controller.BaseController; -//import com.ruoyi.framework.web.domain.AjaxResult; -//import com.ruoyi.framework.web.page.TableDataInfo; -//import com.ruoyi.framework.web.page.TableSupport; -//import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice; -//import com.ruoyi.project.data.price.service.IOfficeBasePriceUltimateService; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.security.access.prepost.PreAuthorize; -//import org.springframework.web.bind.annotation.*; -//import org.springframework.web.multipart.MultipartFile; -// -//import java.util.List; -// -///** -// * 【请填写功能名称】Controller -// * -// * @author ruoyi -// * @date 2020-05-20 -// */ -//@RestController -//@RequestMapping("/data/compute/price/office") -//public class ArtificialOfficeBasePriceController extends BaseController { -// @Autowired -// private IOfficeBasePriceUltimateService officeBasePriceUltimateService; -// @Autowired -// private TokenService tokenService; -// -// /** -// * 查询【请填写功能名称】列表 -// */ -// @PreAuthorize("@ss.hasPermi('system:user:list')") -// @GetMapping("/list") -// public TableDataInfo list(OfficeBasePriceUltimate officeBasePriceUltimate) { -// int pageIndex = ServletUtils.getParameterToInt(TableSupport.PAGE_NUM); -// int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE); -// officeBasePriceUltimate.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize); -// officeBasePriceUltimate.setPageSize(pageSize); -// List list = -// officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate); -// int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate); -// return getDataTable(list, total); -// } -// -// -// /** -// * 获取【请填写功能名称】详细信息 -// */ -// @PreAuthorize("@ss.hasPermi('system:user:query')") -// @GetMapping(value = "/{id}") -// public AjaxResult getInfo(@PathVariable("id") String id) { -// return AjaxResult.success(officeBasePriceUltimateService.selectOfficeBasePriceUltimateById(id)); -// } -// -// /** -// * 修改【请填写功能名称】 -// */ -// @PreAuthorize("@ss.hasPermi('system:user:edit')") -// @Log(title = "办公基价", businessType = BusinessType.UPDATE) -// @PutMapping -// public AjaxResult edit(@RequestBody OfficeBasePriceUltimate officeBasePriceUltimate) { -// return toAjax(officeBasePriceUltimateService.updateOfficeBasePriceUltimate(officeBasePriceUltimate)); -// } -// -// /** -// * 导出【请填写功能名称】列表 -// */ -// @PreAuthorize("@ss.hasPermi('system:user:export')") -// @Log(title = "办公基价", businessType = BusinessType.EXPORT) -// @GetMapping("/export") -// public AjaxResult export(OfficeBasePriceUltimate officeBasePriceUltimate) { -// int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate); -// officeBasePriceUltimate.setPageIndex(0); -// officeBasePriceUltimate.setPageSize(total); -// List list = -// officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate); -// ExcelUtil util = new ExcelUtil(OfficeBasePriceUltimate.class); -// return util.exportExcel(list, "办公基价"); -// } -// -// /** -// * 办公基价导入 -// * @param file -// * @return -// * @throws Exception -// */ -// @Log(title = "办公基价", businessType = BusinessType.IMPORT) -// @PreAuthorize("@ss.hasPermi('system:user:import')") -// @PostMapping("/importData") -// public AjaxResult importData(MultipartFile file) throws Exception { -// ExcelUtil util = new ExcelUtil<>(OfficeBasePriceUltimate.class); -// List officeBasePriceUltimates = util.importExcel(file.getInputStream()); -// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); -// String operName = loginUser.getUsername(); -// String message = officeBasePriceUltimateService.batchImport(officeBasePriceUltimates, operName); -// return AjaxResult.success(message); -// } -// -//} -// diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ArtificialResidenceSaleBasePriceController.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ArtificialResidenceSaleBasePriceController.java deleted file mode 100644 index ae99d56a1..000000000 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ArtificialResidenceSaleBasePriceController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.ruoyi.project.data.price.controller; - -public class ArtificialResidenceSaleBasePriceController { -} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ResidenceSaleBasePriceController.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ResidenceSaleBasePriceController.java new file mode 100644 index 000000000..eeff932d7 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/controller/ResidenceSaleBasePriceController.java @@ -0,0 +1,267 @@ +package com.ruoyi.project.data.price.controller; + +import com.ruoyi.common.exception.CustomException; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.framework.config.RuoYiConfig; +import com.ruoyi.framework.security.LoginUser; +import com.ruoyi.framework.security.service.TokenService; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.framework.web.page.TableSupport; +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; +import com.ruoyi.project.data.price.service.IArtificialResidenceRentPriceService; +import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService; +import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService; +import com.ruoyi.project.data.price.service.IUltimateResidenceRentBasePriceService; +import com.ruoyi.project.system.domain.UploadFile; +import com.ruoyi.project.system.service.IUploadFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@RestController +@RequestMapping("/data/price/residence/sale") +public class ResidenceSaleBasePriceController extends BaseController { + + @Autowired + private IOriginalResidenceSalePriceService computeResidenceSalePriceService; + @Autowired + private IArtificialResidenceSalePriceService artificialResidenceSalePriceService; + @Autowired + private IUltimateResidenceRentBasePriceService ultimateResidenceRentBasePriceService; + @Autowired + private IUploadFileService fileService; + @Autowired + private TokenService tokenService; + + /** + * 查询 住宅租赁基价列表 + */ + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/compute/list") + public TableDataInfo computeList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice) { + int pageIndex = ServletUtils.getParameterToInt("pageIndex"); + int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE); + computeResidenceSaleBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize); + computeResidenceSaleBasePrice.setPageSize(pageSize); + + int total = computeResidenceSalePriceService.selectCount(computeResidenceSaleBasePrice); + List list = + computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice); + list.forEach(x -> x.setYearMonth(computeResidenceSaleBasePrice.getYearMonth())); + return getDataTable(list, total); + } + + /** + * 查询 年月 + */ + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/compute/yearmonth") + public AjaxResult computeYearMonthList() { + List list = computeResidenceSalePriceService.getYearMonth(); + + return AjaxResult.success(list); + } + + /** + * 导出 住宅销售基价列表 + */ + @PreAuthorize("@ss.hasPermi('system:user:export')") + @Log(title = "住宅销售基价", businessType = BusinessType.EXPORT) + @GetMapping("/compute/export") + public AjaxResult computeExport(ComputeResidenceSaleBasePrice + computeResidenceSaleBasePrice) { + int total = computeResidenceSalePriceService.selectCount(computeResidenceSaleBasePrice); + computeResidenceSaleBasePrice.setPageIndex(0); + computeResidenceSaleBasePrice.setPageSize(total); + List list = + computeResidenceSalePriceService.selectList(computeResidenceSaleBasePrice); + ExcelUtil util = new ExcelUtil<>(ComputeResidenceSaleBasePrice.class); + return util.exportExcel(list, "住宅销售基价" + computeResidenceSaleBasePrice.getYearMonth()); + } + + /** + * 查询 住宅租赁基价列表 + */ + @PreAuthorize("@ss.hasPermi('system:artificial:list')") + @GetMapping("/artificial/list") + public TableDataInfo artificialList(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice) { + int pageIndex = ServletUtils.getParameterToInt("pageIndex"); + int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE); + artificialResidenceSaleBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize); + artificialResidenceSaleBasePrice.setPageSize(pageSize); + + int total = artificialResidenceSalePriceService.selectCount(artificialResidenceSaleBasePrice); + List list = + artificialResidenceSalePriceService.selectList(artificialResidenceSaleBasePrice); + list.forEach(x -> x.setYearMonth(artificialResidenceSaleBasePrice.getYearMonth())); + return getDataTable(list, total); + } + + /** + * 查询 年月 + */ + @PreAuthorize("@ss.hasPermi('system:artificial:list')") + @GetMapping("/artificial/yearmonth") + public AjaxResult artificialYearMonthList() { + List list = artificialResidenceSalePriceService.getYearMonth(); + + return AjaxResult.success(list); + } + + /** + * 导出 住宅销售基价列表 + */ + @PreAuthorize("@ss.hasPermi('system:artificial:export')") + @Log(title = "住宅销售基价", businessType = BusinessType.EXPORT) + @GetMapping("/artificial/export") + public AjaxResult artificialExport(ArtificialResidenceSaleBasePrice + artificialResidenceSaleBasePrice) { + int total = artificialResidenceSalePriceService.selectCount(artificialResidenceSaleBasePrice); + artificialResidenceSaleBasePrice.setPageIndex(0); + artificialResidenceSaleBasePrice.setPageSize(total); + List list = + artificialResidenceSalePriceService.selectList(artificialResidenceSaleBasePrice); + ExcelUtil util = new ExcelUtil<>(ArtificialResidenceSaleBasePrice.class); + return util.exportExcel(list, "人工修正住宅销售基价" + artificialResidenceSaleBasePrice.getYearMonth()); + } + + /** + * 获取 人工修正基价详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping(value = "/artificial/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + return AjaxResult.success(artificialResidenceSalePriceService.selectById(id)); + } + + /** + * 修改 住宅租赁基价 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "住宅售价基价", businessType = BusinessType.UPDATE) + @PutMapping(value = "/artificial") + public AjaxResult edit(@RequestBody ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice) { + return toAjax(artificialResidenceSalePriceService.updateEntity(artificialResidenceSaleBasePrice)); + } + + /** + * 办公基价导入 + * + * @param file + * @return + * @throws Exception + */ + @Log(title = "办公基价", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('system:user:import')") + @PostMapping("/artificial/importData/{yearMonth}") + public AjaxResult importData(@PathVariable("yearMonth") Integer yearMonth, + MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil<>(ComputeResidenceSaleBasePrice.class); + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + String operName = loginUser.getUsername(); + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + UploadFile uploadFile = new UploadFile(); + uploadFile.setFk(yearMonth.toString()); + uploadFile.setSaveFileName(fileName); + uploadFile.setFileName(file.getOriginalFilename()); + uploadFile.setModuleName("人工修正住宅销售基价"); + uploadFile.setCreateBy(operName); + fileService.insert(uploadFile); + + List artificialResidenceSaleBasePrices = util.importExcel(file.getInputStream + ()); + if (StringUtils.isNull(artificialResidenceSaleBasePrices) || artificialResidenceSaleBasePrices.size() == 0) { + throw new CustomException("人工修正住宅销售基价不能为空!"); + } + String message = artificialResidenceSalePriceService.batchImport(yearMonth, artificialResidenceSaleBasePrices); + return AjaxResult.success(message); + } + +// +// /** +// * 人工修正住宅租赁 +// * +// * @param artificialResidenceRentBasePrice +// * @return +// */ +// @PreAuthorize("@ss.hasPermi('system:user:list')") +// @GetMapping("/artificial/list") +// public TableDataInfo artificialByList(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice) { +// int pageIndex = ServletUtils.getParameterToInt("pageIndex"); +// int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE); +// artificialResidenceRentBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize); +// artificialResidenceRentBasePrice.setPageSize(pageSize); +// +// int total = artificialResidenceRentPriceService.selectCount(artificialResidenceRentBasePrice); +// List list = +// artificialResidenceRentPriceService.selectList(artificialResidenceRentBasePrice); +// list.forEach(x -> x.setYearMonth(artificialResidenceRentBasePrice.getYearMonth())); +// return getDataTable(list, total); +// } +// +// +// // 文件保存 +// +// +// /** +// * 查询 住宅租赁基价列表 +// */ +// @PreAuthorize("@ss.hasPermi('system:user:list')") +// @GetMapping("/ultimate/list") +// public TableDataInfo ultimateResidenceRentBasePriceList(UltimateResidenceRentBasePrice +// ultimateResidenceRentBasePrice) { +// int pageIndex = ServletUtils.getParameterToInt("pageIndex"); +// int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE); +// ultimateResidenceRentBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize); +// ultimateResidenceRentBasePrice.setPageSize(pageSize); +// +// int total = ultimateResidenceRentBasePriceService.selectCount(ultimateResidenceRentBasePrice); +// List list = +// ultimateResidenceRentBasePriceService.selectList(ultimateResidenceRentBasePrice); +// list.forEach(x -> x.setYearMonth(ultimateResidenceRentBasePrice.getYearMonth())); +// return getDataTable(list, total); +// } +// +// /** +// * 人工审核住宅租赁基价导入(模板) +// * 记录变化的值和变化次数 +// */ +// +// /** +// * 获取 住宅租赁基价详细信息 +// */ +// @PreAuthorize("@ss.hasPermi('system:user:query')") +// @GetMapping(value = "/ultimate/{id}") +// public AjaxResult ultimateResidenceRentBasePriceGet(@PathVariable("id") Integer id) { +// return AjaxResult.success(ultimateResidenceRentBasePriceService.selectById(id)); +// } +// +// /** +// * 修改 住宅租赁基价 +// */ +// @PreAuthorize("@ss.hasPermi('system:user:edit')") +// @Log(title = "住宅租赁基价", businessType = BusinessType.UPDATE) +// @PutMapping(value = "/ultimate") +// public AjaxResult ultimateResidenceRentBasePriceEdit(@RequestBody UltimateResidenceRentBasePrice +// ultimateResidenceRentBasePrice) { +// return toAjax(ultimateResidenceRentBasePriceService.update(ultimateResidenceRentBasePrice)); +// } +// + + +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ArtificialResidenceSaleBasePrice.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ArtificialResidenceSaleBasePrice.java index b595488a2..c2043678d 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ArtificialResidenceSaleBasePrice.java +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ArtificialResidenceSaleBasePrice.java @@ -4,173 +4,48 @@ import com.alibaba.fastjson.annotation.JSONField; import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.web.domain.BaseEntity; +import java.math.BigDecimal; import java.util.Date; /** - * 【请填写功能名称】对象 office_base_price_ultimate - * - * @author ruoyi - * @date 2020-05-20 + * 人工修正住宅基价 */ -public class ArtificialResidenceSaleBasePrice extends BaseEntity { +public class ArtificialResidenceSaleBasePrice extends ComputeResidenceSaleBasePrice { - private Integer pageIndex; - private Integer pageSize; + /** + * 价值时点 + */ + private Date valuePoint; + /** + * 上期价值时点 + */ + private Date lastValuePoint; + /** + * 价格id(随机生成) + */ + private String priceId; - @Excel(name = "ID") - private String id; - @JSONField(serialize = false) - private Integer yearMonth; - @Excel(name = "楼栋ID") - private String buildingId; - @Excel(name = "小区ID") - private String communityId; - @Excel(name = "主力基价") - private String mainPrice; - @Excel(name = "主力租金") - private String mainPriceRent; - @Excel(name = "主力基价涨跌幅") - private String mainPricePst; - @Excel(name = "主力租金涨跌幅") - private String mainPriceRentPst; - @Excel(name = "主力基价类型") - private String mainPriceType; - @Excel(name = "主力租金类型") - private String mainPriceRentType; - @Excel(name = "更新日期") - private Date updateDate; - @Excel(name = "状态") - private Boolean status; - @Excel(name = "是否标准楼栋") - private Boolean isStandardBuilding; - @Excel(name = "更改价格说明") - private String adjustPriceComment; - - public String getId() { - return id; + public Date getValuePoint() { + return valuePoint; } - public void setId(String id) { - this.id = id; + public void setValuePoint(Date valuePoint) { + this.valuePoint = valuePoint; } - public Integer getYearMonth() { - return yearMonth; + public String getPriceId() { + return priceId; } - public void setYearMonth(Integer yearMonth) { - this.yearMonth = yearMonth; + public void setPriceId(String priceId) { + this.priceId = priceId; } - public String getBuildingId() { - return buildingId; + public Date getLastValuePoint() { + return lastValuePoint; } - public void setBuildingId(String buildingId) { - this.buildingId = buildingId; - } - - public String getCommunityId() { - return communityId; - } - - public void setCommunityId(String communityId) { - this.communityId = communityId; - } - - public String getMainPrice() { - return mainPrice; - } - - public void setMainPrice(String mainPrice) { - this.mainPrice = mainPrice; - } - - public String getMainPriceRent() { - return mainPriceRent; - } - - public void setMainPriceRent(String mainPriceRent) { - this.mainPriceRent = mainPriceRent; - } - - public String getMainPricePst() { - return mainPricePst; - } - - public void setMainPricePst(String mainPricePst) { - this.mainPricePst = mainPricePst; - } - - public String getMainPriceRentPst() { - return mainPriceRentPst; - } - - public void setMainPriceRentPst(String mainPriceRentPst) { - this.mainPriceRentPst = mainPriceRentPst; - } - - public String getMainPriceType() { - return mainPriceType; - } - - public void setMainPriceType(String mainPriceType) { - this.mainPriceType = mainPriceType; - } - - public String getMainPriceRentType() { - return mainPriceRentType; - } - - public void setMainPriceRentType(String mainPriceRentType) { - this.mainPriceRentType = mainPriceRentType; - } - - public Date getUpdateDate() { - return updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public Boolean getStatus() { - return status; - } - - public void setStatus(Boolean status) { - this.status = status; - } - - public Boolean getStandardBuilding() { - return isStandardBuilding; - } - - public void setStandardBuilding(Boolean standardBuilding) { - isStandardBuilding = standardBuilding; - } - - public String getAdjustPriceComment() { - return adjustPriceComment; - } - - public void setAdjustPriceComment(String adjustPriceComment) { - this.adjustPriceComment = adjustPriceComment; - } - - public Integer getPageIndex() { - return pageIndex; - } - - public void setPageIndex(Integer pageIndex) { - this.pageIndex = pageIndex; - } - - public Integer getPageSize() { - return pageSize; - } - - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; + public void setLastValuePoint(Date lastValuePoint) { + this.lastValuePoint = lastValuePoint; } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ComputeResidenceSaleBasePrice.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ComputeResidenceSaleBasePrice.java index a437d20c5..8f8cc4eb6 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ComputeResidenceSaleBasePrice.java +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/domain/ComputeResidenceSaleBasePrice.java @@ -4,159 +4,167 @@ import com.alibaba.fastjson.annotation.JSONField; import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.web.domain.BaseEntity; +import java.math.BigDecimal; import java.util.Date; /** - * 【请填写功能名称】对象 office_base_price_ultimate + * 计算的住宅小区售价 * * @author ruoyi * @date 2020-05-20 */ public class ComputeResidenceSaleBasePrice extends BaseEntity { - private Integer pageIndex; private Integer pageSize; @JSONField(serialize = false) private Integer yearMonth; + @JSONField(serialize = false) + private String nameOrAddress; @Excel(name = "ID") private String id; - @Excel(name = "楼栋ID") - private String buildingId; - @Excel(name = "小区ID") + @Excel(name = "AI小区ID") private String communityId; - @Excel(name = "主力基价") - private String mainPrice; - @Excel(name = "主力租金") - private String mainPriceRent; - @Excel(name = "主力基价涨跌幅") - private String mainPricePst; - @Excel(name = "主力租金涨跌幅") - private String mainPriceRentPst; - @Excel(name = "主力基价类型") - private String mainPriceType; - @Excel(name = "主力租金类型") - private String mainPriceRentType; - @Excel(name = "更新日期") - private Date updateDate; - @Excel(name = "状态") - private Boolean status; - @Excel(name = "是否标准楼栋") - private Boolean isStandardBuilding; - @Excel(name = "更改价格说明") - private String adjustPriceComment; + @Excel(name = "小区名称") + private String communityName; + @Excel(name = "小区地址") + private String communityAddress; + @Excel(name = "区域") + private String countyName; + @Excel(name = "板块") + private String blockName; + @Excel(name = "环线") + private String loopName; + @Excel(name = "是否生成索引") + private Integer hasIndex; + @Excel(name = "参与涨幅计算") + private Integer isPstCalc; + @Excel(name = "运行状态") + private Integer status; + @Excel(name = "特殊小区标签") + private String label; + @Excel(name = "物业类型") + private String propertyType; + @Excel(name = "小区类型") + private String projectType; + @Excel(name = "小区类型细分") + private String projectTypeDtl; + @Excel(name = "物业档次") + private String propertyLevel; + @Excel(name = "建成年代") + private Integer year; + @Excel(name = "主力面积") + private BigDecimal area; + @Excel(name = "房屋面积系数") + private BigDecimal areaCoefficient; + @Excel(name = "建成年代系数") + private BigDecimal yearCoefficient; + @Excel(name = "价格说明") + private String comment; + @Excel(name = "AI基价(草稿)") + private BigDecimal basePriceDraft; + @Excel(name = "主力基价(草稿)") + private BigDecimal mainPriceDraft; + @Excel(name = "上月AI基价") + private BigDecimal basePrice_1; + @Excel(name = "价格涨跌幅类型-调整后") + private String voppat; + @Excel(name = "价格涨跌幅-调整后") + private BigDecimal voppa; + @Excel(name = "案例均价") + private BigDecimal priceUnitAdj; + /** + * 累计带看 + */ + @Excel(name = "平均访客数量") + private Integer visitedNum; + /** + * 首次带看日 + */ + @Excel(name = "首次看房时间") + private Date firstVisitTime; + /** + * 近15日带看 + */ + @Excel(name = "15天内平均访客数量") + private Integer visitedNum15; + /** + * 近30天带看 + */ + @Excel(name = "30天内平均访客数量") + private Integer visitedNum30; + @Excel(name = "成交均价(上周期)") + private BigDecimal priceDealMean_1; + @Excel(name = "成交最大价(上周期)") + private BigDecimal priceDealMax_1; + @Excel(name = "成交数量(上周期)") + private Integer sumDeal_1; + @Excel(name = "成交均价") + private BigDecimal priceDealMean; + @Excel(name = "成交最大价") + private BigDecimal priceDealMax; + @Excel(name = "成交数量") + private Integer sumDeal; - public String getId() { - return id; - } + @Excel(name = "挂牌最低价") + private Integer priceListedMin; + @Excel(name = "与上月AI基价链家1案例价格价调整比例") + private BigDecimal priceCase1_ToAI_Pst; + @Excel(name = "与上月AI基价链家2案例价格价调整比例") + private BigDecimal priceCase2_ToAI_Pst; + @Excel(name = "当月比上月链1案例价调整比例") + private BigDecimal priceCase1_ToLst_Pst; + @Excel(name = "当月比上月链2案例价调整比例") + private BigDecimal priceCase2_ToLst_Pst; - public void setId(String id) { - this.id = id; - } + @Excel(name = "链家1案例价") + private BigDecimal priceCase1; + @Excel(name = "链家1调价幅度") + private BigDecimal priceCase1AdjPst; + @Excel(name = "链家1案例总量") + private Integer sumCase1; + @Excel(name = "链家2案例价") + private BigDecimal priceCase2; + @Excel(name = "链家2调价幅度") + private BigDecimal priceCase2AdjPst; + @Excel(name = "链家2案例总量") + private Integer sumCase2; - public Integer getYearMonth() { - return yearMonth; - } + @Excel(name = "价格涨跌幅类型-调整前") + private String voppbt; + @Excel(name = "价格涨跌幅-调整前") + private BigDecimal voppb; - public void setYearMonth(Integer yearMonth) { - this.yearMonth = yearMonth; - } - - public String getBuildingId() { - return buildingId; - } - - public void setBuildingId(String buildingId) { - this.buildingId = buildingId; - } - - public String getCommunityId() { - return communityId; - } - - public void setCommunityId(String communityId) { - this.communityId = communityId; - } - - public String getMainPrice() { - return mainPrice; - } - - public void setMainPrice(String mainPrice) { - this.mainPrice = mainPrice; - } - - public String getMainPriceRent() { - return mainPriceRent; - } - - public void setMainPriceRent(String mainPriceRent) { - this.mainPriceRent = mainPriceRent; - } - - public String getMainPricePst() { - return mainPricePst; - } - - public void setMainPricePst(String mainPricePst) { - this.mainPricePst = mainPricePst; - } - - public String getMainPriceRentPst() { - return mainPriceRentPst; - } - - public void setMainPriceRentPst(String mainPriceRentPst) { - this.mainPriceRentPst = mainPriceRentPst; - } - - public String getMainPriceType() { - return mainPriceType; - } - - public void setMainPriceType(String mainPriceType) { - this.mainPriceType = mainPriceType; - } - - public String getMainPriceRentType() { - return mainPriceRentType; - } - - public void setMainPriceRentType(String mainPriceRentType) { - this.mainPriceRentType = mainPriceRentType; - } - - public Date getUpdateDate() { - return updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public Boolean getStatus() { - return status; - } - - public void setStatus(Boolean status) { - this.status = status; - } - - public Boolean getStandardBuilding() { - return isStandardBuilding; - } - - public void setStandardBuilding(Boolean standardBuilding) { - isStandardBuilding = standardBuilding; - } - - public String getAdjustPriceComment() { - return adjustPriceComment; - } - - public void setAdjustPriceComment(String adjustPriceComment) { - this.adjustPriceComment = adjustPriceComment; - } + @Excel(name = "绑定小区编号") + // BindProjID + private String bindCommunityId; + @Excel(name = "绑定小区涨跌幅") + // Bind_Proj_Pst + private BigDecimal bindCommunityPst; + @Excel(name = "绑定板块+聚类ID") + // Bind_Block_Class + private String bindBlockClass; + @Excel(name = "绑定板块+聚类ID的涨跌幅") + // Bind_Block_Class_Pst + private BigDecimal bindBlockClassPst; + @Excel(name = "绑定板块+物业档次") + // Bind_Block_Plevel + private String bindBlockPropertyLevel; + @Excel(name = "绑定板块+物业档次的涨跌幅") + // Bind_Block_Plevel_Pst + private BigDecimal bindBlockPropertyLevelPst; + @Excel(name = "绑定板块+小区类型") + // Bind_Block_PType + private String bindBlockProjectType; + @Excel(name = "绑定板块+小区类型的涨跌幅") + // Bind_Block_Ptype_Pst + private BigDecimal bindBlockProjectTypePst; + @Excel(name = "绑定区县+小区类型") + // Bind_County_PType + private String bindCountyProjectType; + @Excel(name = "绑定区县+小区类型的涨跌幅") + // Bind_County_PType_Pst + private BigDecimal bindCountyProjectTypePst; public Integer getPageIndex() { return pageIndex; @@ -173,4 +181,494 @@ public class ComputeResidenceSaleBasePrice extends BaseEntity { public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } + + public Integer getYearMonth() { + return yearMonth; + } + + public void setYearMonth(Integer yearMonth) { + this.yearMonth = yearMonth; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCommunityId() { + return communityId; + } + + public void setCommunityId(String communityId) { + this.communityId = communityId; + } + + public String getCommunityName() { + return communityName; + } + + public void setCommunityName(String communityName) { + this.communityName = communityName; + } + + public String getCommunityAddress() { + return communityAddress; + } + + public void setCommunityAddress(String communityAddress) { + this.communityAddress = communityAddress; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getBlockName() { + return blockName; + } + + public void setBlockName(String blockName) { + this.blockName = blockName; + } + + public String getLoopName() { + return loopName; + } + + public void setLoopName(String loopName) { + this.loopName = loopName; + } + + public Integer getHasIndex() { + return hasIndex; + } + + public void setHasIndex(Integer hasIndex) { + this.hasIndex = hasIndex; + } + + public Integer getIsPstCalc() { + return isPstCalc; + } + + public void setIsPstCalc(Integer isPstCalc) { + this.isPstCalc = isPstCalc; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getPropertyType() { + return propertyType; + } + + public void setPropertyType(String propertyType) { + this.propertyType = propertyType; + } + + public String getProjectType() { + return projectType; + } + + public void setProjectType(String projectType) { + this.projectType = projectType; + } + + public String getProjectTypeDtl() { + return projectTypeDtl; + } + + public void setProjectTypeDtl(String projectTypeDtl) { + this.projectTypeDtl = projectTypeDtl; + } + + public String getPropertyLevel() { + return propertyLevel; + } + + public void setPropertyLevel(String propertyLevel) { + this.propertyLevel = propertyLevel; + } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public BigDecimal getArea() { + return area; + } + + public void setArea(BigDecimal area) { + this.area = area; + } + + public BigDecimal getAreaCoefficient() { + return areaCoefficient; + } + + public void setAreaCoefficient(BigDecimal areaCoefficient) { + this.areaCoefficient = areaCoefficient; + } + + public BigDecimal getYearCoefficient() { + return yearCoefficient; + } + + public void setYearCoefficient(BigDecimal yearCoefficient) { + this.yearCoefficient = yearCoefficient; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public BigDecimal getBasePriceDraft() { + return basePriceDraft; + } + + public void setBasePriceDraft(BigDecimal basePriceDraft) { + this.basePriceDraft = basePriceDraft; + } + + public BigDecimal getMainPriceDraft() { + return mainPriceDraft; + } + + public void setMainPriceDraft(BigDecimal mainPriceDraft) { + this.mainPriceDraft = mainPriceDraft; + } + + public BigDecimal getBasePrice_1() { + return basePrice_1; + } + + public void setBasePrice_1(BigDecimal basePrice_1) { + this.basePrice_1 = basePrice_1; + } + + + + public BigDecimal getPriceUnitAdj() { + return priceUnitAdj; + } + + public void setPriceUnitAdj(BigDecimal priceUnitAdj) { + this.priceUnitAdj = priceUnitAdj; + } + + public Integer getVisitedNum() { + return visitedNum; + } + + public void setVisitedNum(Integer visitedNum) { + this.visitedNum = visitedNum; + } + + public Date getFirstVisitTime() { + return firstVisitTime; + } + + public void setFirstVisitTime(Date firstVisitTime) { + this.firstVisitTime = firstVisitTime; + } + + public Integer getVisitedNum15() { + return visitedNum15; + } + + public void setVisitedNum15(Integer visitedNum15) { + this.visitedNum15 = visitedNum15; + } + + public Integer getVisitedNum30() { + return visitedNum30; + } + + public void setVisitedNum30(Integer visitedNum30) { + this.visitedNum30 = visitedNum30; + } + + public BigDecimal getPriceDealMean_1() { + return priceDealMean_1; + } + + public void setPriceDealMean_1(BigDecimal priceDealMean_1) { + this.priceDealMean_1 = priceDealMean_1; + } + + public BigDecimal getPriceDealMax_1() { + return priceDealMax_1; + } + + public void setPriceDealMax_1(BigDecimal priceDealMax_1) { + this.priceDealMax_1 = priceDealMax_1; + } + + public Integer getSumDeal_1() { + return sumDeal_1; + } + + public void setSumDeal_1(Integer sumDeal_1) { + this.sumDeal_1 = sumDeal_1; + } + + public BigDecimal getPriceDealMean() { + return priceDealMean; + } + + public void setPriceDealMean(BigDecimal priceDealMean) { + this.priceDealMean = priceDealMean; + } + + public BigDecimal getPriceDealMax() { + return priceDealMax; + } + + public void setPriceDealMax(BigDecimal priceDealMax) { + this.priceDealMax = priceDealMax; + } + + public Integer getSumDeal() { + return sumDeal; + } + + public void setSumDeal(Integer sumDeal) { + this.sumDeal = sumDeal; + } + + public Integer getPriceListedMin() { + return priceListedMin; + } + + public void setPriceListedMin(Integer priceListedMin) { + this.priceListedMin = priceListedMin; + } + + public BigDecimal getPriceCase1_ToAI_Pst() { + return priceCase1_ToAI_Pst; + } + + public void setPriceCase1_ToAI_Pst(BigDecimal priceCase1_ToAI_Pst) { + this.priceCase1_ToAI_Pst = priceCase1_ToAI_Pst; + } + + public BigDecimal getPriceCase2_ToAI_Pst() { + return priceCase2_ToAI_Pst; + } + + public void setPriceCase2_ToAI_Pst(BigDecimal priceCase2_ToAI_Pst) { + this.priceCase2_ToAI_Pst = priceCase2_ToAI_Pst; + } + + public BigDecimal getPriceCase1_ToLst_Pst() { + return priceCase1_ToLst_Pst; + } + + public void setPriceCase1_ToLst_Pst(BigDecimal priceCase1_ToLst_Pst) { + this.priceCase1_ToLst_Pst = priceCase1_ToLst_Pst; + } + + public BigDecimal getPriceCase2_ToLst_Pst() { + return priceCase2_ToLst_Pst; + } + + public void setPriceCase2_ToLst_Pst(BigDecimal priceCase2_ToLst_Pst) { + this.priceCase2_ToLst_Pst = priceCase2_ToLst_Pst; + } + + public BigDecimal getPriceCase1() { + return priceCase1; + } + + public void setPriceCase1(BigDecimal priceCase1) { + this.priceCase1 = priceCase1; + } + + public BigDecimal getPriceCase1AdjPst() { + return priceCase1AdjPst; + } + + public void setPriceCase1AdjPst(BigDecimal priceCase1AdjPst) { + this.priceCase1AdjPst = priceCase1AdjPst; + } + + public Integer getSumCase1() { + return sumCase1; + } + + public void setSumCase1(Integer sumCase1) { + this.sumCase1 = sumCase1; + } + + public BigDecimal getPriceCase2() { + return priceCase2; + } + + public void setPriceCase2(BigDecimal priceCase2) { + this.priceCase2 = priceCase2; + } + + public BigDecimal getPriceCase2AdjPst() { + return priceCase2AdjPst; + } + + public void setPriceCase2AdjPst(BigDecimal priceCase2AdjPst) { + this.priceCase2AdjPst = priceCase2AdjPst; + } + + public Integer getSumCase2() { + return sumCase2; + } + + public void setSumCase2(Integer sumCase2) { + this.sumCase2 = sumCase2; + } + + public String getVoppbt() { + return voppbt; + } + + public void setVoppbt(String voppbt) { + this.voppbt = voppbt; + } + + public String getBindCommunityId() { + return bindCommunityId; + } + + public void setBindCommunityId(String bindCommunityId) { + this.bindCommunityId = bindCommunityId; + } + + public BigDecimal getBindCommunityPst() { + return bindCommunityPst; + } + + public void setBindCommunityPst(BigDecimal bindCommunityPst) { + this.bindCommunityPst = bindCommunityPst; + } + + public String getBindBlockClass() { + return bindBlockClass; + } + + public void setBindBlockClass(String bindBlockClass) { + this.bindBlockClass = bindBlockClass; + } + + public BigDecimal getBindBlockClassPst() { + return bindBlockClassPst; + } + + public void setBindBlockClassPst(BigDecimal bindBlockClassPst) { + this.bindBlockClassPst = bindBlockClassPst; + } + + public String getBindBlockPropertyLevel() { + return bindBlockPropertyLevel; + } + + public void setBindBlockPropertyLevel(String bindBlockPropertyLevel) { + this.bindBlockPropertyLevel = bindBlockPropertyLevel; + } + + public BigDecimal getBindBlockPropertyLevelPst() { + return bindBlockPropertyLevelPst; + } + + public void setBindBlockPropertyLevelPst(BigDecimal bindBlockPropertyLevelPst) { + this.bindBlockPropertyLevelPst = bindBlockPropertyLevelPst; + } + + public String getBindBlockProjectType() { + return bindBlockProjectType; + } + + public void setBindBlockProjectType(String bindBlockProjectType) { + this.bindBlockProjectType = bindBlockProjectType; + } + + public BigDecimal getBindBlockProjectTypePst() { + return bindBlockProjectTypePst; + } + + public void setBindBlockProjectTypePst(BigDecimal bindBlockProjectTypePst) { + this.bindBlockProjectTypePst = bindBlockProjectTypePst; + } + + public String getBindCountyProjectType() { + return bindCountyProjectType; + } + + public void setBindCountyProjectType(String bindCountyProjectType) { + this.bindCountyProjectType = bindCountyProjectType; + } + + public BigDecimal getBindCountyProjectTypePst() { + return bindCountyProjectTypePst; + } + + public void setBindCountyProjectTypePst(BigDecimal bindCountyProjectTypePst) { + this.bindCountyProjectTypePst = bindCountyProjectTypePst; + } + + public String getVoppat() { + return voppat; + } + + public void setVoppat(String voppat) { + this.voppat = voppat; + } + + public BigDecimal getVoppa() { + return voppa; + } + + public void setVoppa(BigDecimal voppa) { + this.voppa = voppa; + } + + public BigDecimal getVoppb() { + return voppb; + } + + public void setVoppb(BigDecimal voppb) { + this.voppb = voppb; + } + + public String getNameOrAddress() { + return nameOrAddress; + } + + public void setNameOrAddress(String nameOrAddress) { + this.nameOrAddress = nameOrAddress; + } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceRentPriceMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceRentPriceMapper.java index 1c5b55cad..e89ad7bcf 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceRentPriceMapper.java +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceRentPriceMapper.java @@ -6,7 +6,7 @@ import com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice; import java.util.List; /** - * 【请填写功能名称】Mapper接口 + * Mapper接口 * * @author ruoyi * @date 2020-05-20 diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceSaleBasePriceMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceSaleBasePriceMapper.java new file mode 100644 index 000000000..bc8c1883d --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ArtificialResidenceSaleBasePriceMapper.java @@ -0,0 +1,96 @@ +package com.ruoyi.project.data.price.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@DS("compute") +public interface ArtificialResidenceSaleBasePriceMapper { + + /** + * @param id + * @return + */ + ArtificialResidenceSaleBasePrice selectById(String id); + + /** + * 新增 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int insert(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 新增价格插入至基价库 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int insertUVBasePrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 批量插入 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int insertUVDocument(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 修改上期价格 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int updateLastMonthPrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 创建用于批量导入的存储过程 + * + * @param yearMonth + * @return + */ + int prepareBachImport(@Param("yearMonth") Integer yearMonth); + +// /** +// * 修改数据 +// * +// * @param artificialResidenceSaleBasePrice +// * @return +// */ +// int updatePrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + + /** + * 分页列表 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + List selectPageList(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 分页总数 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + Integer selectPageCount(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 更新 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int updateEntity(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * @return + */ + List yearMonthList(); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceRentPriceMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceRentPriceMapper.java index 34b18f1fe..a3c7786fc 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceRentPriceMapper.java +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceRentPriceMapper.java @@ -6,12 +6,7 @@ import com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice; import java.util.List; -/** - * 【请填写功能名称】Mapper接口 - * - * @author ruoyi - * @date 2020-05-20 - */ + @DS("compute") public interface ComputeResidenceRentPriceMapper { diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceSalePriceMapper.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceSalePriceMapper.java new file mode 100644 index 000000000..50bddd0ce --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/mapper/ComputeResidenceSalePriceMapper.java @@ -0,0 +1,32 @@ +package com.ruoyi.project.data.price.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; + +import java.util.List; + +@DS("compute") +public interface ComputeResidenceSalePriceMapper { + + /** + * 分页列表 + * + * @param computeResidenceSaleBasePrice + * @return + */ + List selectPageList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice); + + /** + * 分页总数 + * + * @param computeResidenceSaleBasePrice + * @return + */ + Integer selectPageCount(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice); + + /** + * @return + */ + List yearMonthList(); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/service/IArtificialResidenceSalePriceService.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/IArtificialResidenceSalePriceService.java new file mode 100644 index 000000000..76942f207 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/IArtificialResidenceSalePriceService.java @@ -0,0 +1,64 @@ +package com.ruoyi.project.data.price.service; + +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; + +import java.util.List; + +/** + * 人工修正住宅基价 + */ +public interface IArtificialResidenceSalePriceService { + + /** + * 单个 + * + * @param id + * @return + */ + ArtificialResidenceSaleBasePrice selectById(String id); + + /** + * 分页列表 + * + * @param artificialResidenceSaleBasePrice + * @return 集合 + */ + List selectList(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 分页数量 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int selectCount(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 获取表名 + * + * @return + */ + List getYearMonth(); + + /** + * 更新 + * + * @param artificialResidenceSaleBasePrice + * @return + */ + int updateEntity(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice); + + /** + * 导入 + * + * @param yearMonth + * @param list + * @return + */ + String batchImport(Integer yearMonth, List list); + +} + + diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/service/IOriginalResidenceSalePriceService.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/IOriginalResidenceSalePriceService.java new file mode 100644 index 000000000..b4d3c0e66 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/IOriginalResidenceSalePriceService.java @@ -0,0 +1,39 @@ +package com.ruoyi.project.data.price.service; + +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; + +import java.util.List; + +/** + * 计算住宅基价 + */ +public interface IOriginalResidenceSalePriceService { + + /** + * 查询列表 + * + * @param computeResidenceSaleBasePrice + * @return 集合 + */ + List selectList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice); + + /** + * @param computeResidenceSaleBasePrice + * @return + */ + int selectCount(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice); + + /** + * 获取表名 + * + * @return + */ + List getYearMonth(); + + + + +} + + diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/service/impl/ArtificialResidenceSalePriceServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/impl/ArtificialResidenceSalePriceServiceImpl.java new file mode 100644 index 000000000..18f85317d --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/impl/ArtificialResidenceSalePriceServiceImpl.java @@ -0,0 +1,276 @@ +package com.ruoyi.project.data.price.service.impl; + +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.microsoft.sqlserver.jdbc.*; +import com.ruoyi.common.exception.CustomException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.datasource.DynamicDataSource; +import com.ruoyi.project.common.UVResponse; +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; +import com.ruoyi.project.data.price.mapper.ArtificialResidenceSaleBasePriceMapper; +import com.ruoyi.project.data.price.mapper.ComputeResidenceSalePriceMapper; +import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService; +import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; +import org.springframework.web.client.RestTemplate; + +import javax.sql.DataSource; +import java.sql.*; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 计算住宅基价Service业务层处理 + * + * @author ruoyi + * @date 2020-05-20 + */ +@Service +@DS("compute") +public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResidenceSalePriceService { + + private static final Logger log = LoggerFactory.getLogger(ArtificialResidenceSalePriceServiceImpl.class); + + @Autowired + private ArtificialResidenceSaleBasePriceMapper artificialResidenceSaleBasePriceMapper; + @Autowired + private NamedParameterJdbcTemplate namedParameterJdbcTemplate; + @Autowired + private JdbcTemplate jdbcTemplate; + @Autowired + private TransactionTemplate transactionTemplate; + + @Override + public List selectList(ArtificialResidenceSaleBasePrice computeResidenceSaleBasePrice) { + return artificialResidenceSaleBasePriceMapper.selectPageList(computeResidenceSaleBasePrice); + } + + @Override + public int selectCount(ArtificialResidenceSaleBasePrice computeResidenceSaleBasePrice) { + return artificialResidenceSaleBasePriceMapper.selectPageCount(computeResidenceSaleBasePrice); + } + + @Override + public List getYearMonth() { + return artificialResidenceSaleBasePriceMapper.yearMonthList(); + } + + @Override + public ArtificialResidenceSaleBasePrice selectById(String id) { + return artificialResidenceSaleBasePriceMapper.selectById(id); + } + + @Override + public int updateEntity(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice) { + return artificialResidenceSaleBasePriceMapper.updateEntity(artificialResidenceSaleBasePrice); + } + + @Override +// @Transactional + public String batchImport(Integer yearMonth, List list) { + + int successNum = list.size(); + int failureNum = 0; + StringBuilder failureMsg = new StringBuilder(); + Calendar calendar = Calendar.getInstance(); + calendar.set(yearMonth / 100, (yearMonth % 100) - 1, 1); + Date valuePoint = calendar.getTime(); + calendar.add(Calendar.MONTH, -1); + Date lastValuePoint = calendar.getTime(); + + artificialResidenceSaleBasePriceMapper.prepareBachImport(yearMonth); + CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList<>(); + list.parallelStream().forEach(inputModel -> { + ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice = + new ArtificialResidenceSaleBasePrice(); + BeanUtils.copyProperties(inputModel, + artificialResidenceSaleBasePrice); + artificialResidenceSaleBasePrice.setYearMonth(yearMonth); + artificialResidenceSaleBasePrice.setPriceId(UUID.randomUUID().toString()); + artificialResidenceSaleBasePrice.setValuePoint(valuePoint); + artificialResidenceSaleBasePrice.setLastValuePoint(lastValuePoint); + copyOnWriteArrayList.add(artificialResidenceSaleBasePrice); + }); + + + try { + // 声明变量 + // 构造一个 + String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; + String dbURL = "jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute"; + String name = "sa"; + String pwd = "Lcdatacenter_888"; + Class.forName(driverName); + Connection conn = DriverManager.getConnection(dbURL, name, pwd); + SQLServerDataTable sourceDataTable = new SQLServerDataTable(); + sourceDataTable.addColumnMetadata("communityId", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("communityName", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("communityAddress", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("countyName", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("blockName", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("loopName", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("hasIndex", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("isPstCalc", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("status", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("label", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("propertyType", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("projectType", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("projectTypeDtl", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("propertyLevel", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("year", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("area", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("areaCoefficient", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("yearCoefficient", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("comment", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("basePriceDraft", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("mainPriceDraft", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("basePrice_1", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("voppat", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("voppa", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceUnitAdj", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("visitedNum", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("firstVisitTime", java.sql.Types.DATE); + sourceDataTable.addColumnMetadata("visitedNum15", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("visitedNum30", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("priceDealMean_1", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceDealMax_1", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("sumDeal_1", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("priceDealMean", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceDealMax", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("sumDeal", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("priceListedMin", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("priceCase1_ToAI_Pst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceCase2_ToAI_Pst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceCase1_ToLst_Pst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceCase2_ToLst_Pst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceCase1", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceCase1AdjPst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("sumCase1", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("priceCase2", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("priceCase2AdjPst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("sumCase2", java.sql.Types.INTEGER); + sourceDataTable.addColumnMetadata("voppbt", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("voppb", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("bindCommunityId", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("bindCommunityPst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("bindBlockClass", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("bindBlockClassPst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("bindBlockPropertyLevel", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("bindBlockPropertyLevelPst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("bindBlockProjectType", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("bindBlockProjectTypePst", java.sql.Types.DECIMAL); + sourceDataTable.addColumnMetadata("bindCountyProjectType", java.sql.Types.NVARCHAR); + sourceDataTable.addColumnMetadata("bindCountyProjectTypePst", java.sql.Types.DECIMAL); + + copyOnWriteArrayList.forEach(x -> { + try { + sourceDataTable.addRow( + x.getCommunityId(), + x.getCommunityName(), + x.getCommunityAddress(), + x.getCountyName(), + x.getBlockName(), + x.getLoopName(), + x.getHasIndex(), + x.getIsPstCalc(), + x.getStatus(), + x.getLabel(), + x.getPropertyType(), + x.getProjectType(), + x.getProjectTypeDtl(), + x.getPropertyLevel(), + x.getYear(), + x.getArea(), + x.getYearCoefficient(), + x.getAreaCoefficient(), + x.getComment(), + x.getBasePriceDraft(), + x.getMainPriceDraft(), + x.getBasePrice_1(), + x.getVoppat(), + x.getVoppa(), + x.getPriceUnitAdj(), + x.getVisitedNum(), + x.getFirstVisitTime(), + x.getVisitedNum15(), + x.getVisitedNum30(), + x.getPriceDealMean_1(), + x.getPriceDealMax_1(), + x.getSumDeal_1(), + x.getPriceDealMean(), + x.getPriceDealMax(), + x.getSumDeal(), + + x.getPriceListedMin(), + x.getPriceCase1_ToAI_Pst(), + x.getPriceCase2_ToAI_Pst(), + x.getPriceCase1_ToLst_Pst(), + x.getPriceCase2_ToLst_Pst(), + x.getPriceCase1(), + x.getPriceCase1AdjPst(), + x.getSumCase1(), + x.getPriceCase2(), + x.getPriceCase2AdjPst(), + x.getSumCase2(), + x.getVoppbt(), + x.getVoppb(), + x.getBindCommunityId(), + x.getBindCommunityPst(), + x.getBindBlockClass(), + x.getBindBlockClassPst(), + x.getBindBlockPropertyLevel(), + x.getBindBlockPropertyLevelPst(), + x.getBindBlockProjectType(), + x.getBindBlockProjectTypePst(), + x.getBindCountyProjectType(), + x.getBindCountyProjectTypePst() + ); + } catch (SQLServerException e) { + e.printStackTrace(); + } + }); + Statement statement = conn.createStatement(); + + + try (CallableStatement cs = conn.prepareCall("{CALL dbo.BatchImportOfArtificialResidenceSale (?)}")) { + ((SQLServerCallableStatement) cs).setStructured(1, "dbo.DWA_PROJECTBASEPRICE_MANU_Table", + sourceDataTable); + boolean resultSetReturned = cs.execute(); + if (resultSetReturned) { + try (ResultSet rs = cs.getResultSet()) { + rs.next(); + System.out.println(rs.getInt(1)); + } + } + } + // 删除存储过程,还原环境 + statement.execute("drop procedure BatchImportOfArtificialResidenceSale"); + conn.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + StringBuilder successMsg = new StringBuilder("恭喜您,数据已全部导入成功!共 " + (successNum - failureNum) + " 条"); + return successMsg.toString(); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/data/price/service/impl/OriginalResidenceSalePriceServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/impl/OriginalResidenceSalePriceServiceImpl.java new file mode 100644 index 000000000..e3c14f7a0 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/data/price/service/impl/OriginalResidenceSalePriceServiceImpl.java @@ -0,0 +1,42 @@ +package com.ruoyi.project.data.price.service.impl; + +import com.ruoyi.project.common.VueSelectModel; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; +import com.ruoyi.project.data.price.mapper.ComputeResidenceSalePriceMapper; +import com.ruoyi.project.data.price.service.IOriginalResidenceSalePriceService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 计算住宅基价Service业务层处理 + * + * @author ruoyi + * @date 2020-05-20 + */ +@Service +public class OriginalResidenceSalePriceServiceImpl implements IOriginalResidenceSalePriceService { + + private static final Logger log = LoggerFactory.getLogger(OriginalResidenceSalePriceServiceImpl.class); + + @Autowired + private ComputeResidenceSalePriceMapper computeResidenceSalePriceMapper; + + @Override + public List selectList(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice) { + return computeResidenceSalePriceMapper.selectPageList(computeResidenceSaleBasePrice); + } + + @Override + public int selectCount(ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice) { + return computeResidenceSalePriceMapper.selectPageCount(computeResidenceSaleBasePrice); + } + + @Override + public List getYearMonth() { + return computeResidenceSalePriceMapper.yearMonthList(); + } +} diff --git a/ruoyi/src/main/resources/application-druid.yml b/ruoyi/src/main/resources/application-druid.yml index d1da7a494..f87b0986c 100644 --- a/ruoyi/src/main/resources/application-druid.yml +++ b/ruoyi/src/main/resources/application-druid.yml @@ -26,6 +26,11 @@ spring: url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data username: sa password: Lcdatacenter_888 + oldProd: + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + url: jdbc:sqlserver://139.196.201.83:8433;DatabaseName=LC_DataCenter + username: sa + password: lc1234 compute: driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute @@ -36,6 +41,11 @@ spring: url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean username: sa password: Lcdatacenter_888 + calc: + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=CALC + username: purple + password: liancheng # druid: # statViewServlet: diff --git a/ruoyi/src/main/resources/application.yml b/ruoyi/src/main/resources/application.yml index eb9b6d7c1..417467b81 100644 --- a/ruoyi/src/main/resources/application.yml +++ b/ruoyi/src/main/resources/application.yml @@ -32,10 +32,15 @@ server: min-spare-threads: 30 # 日志配置 +#logging: +# level: +# com.ruoyi: debug +# org.springframework: warn logging: level: - com.ruoyi: debug - org.springframework: warn + root: debug + path: C:\workshop\logs\ruoyi\ + config: classpath:logback-spring.xml # Spring配置 spring: diff --git a/ruoyi/src/main/resources/logback-spring.xml b/ruoyi/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..5538041da --- /dev/null +++ b/ruoyi/src/main/resources/logback-spring.xml @@ -0,0 +1,152 @@ + + + + + uv-data + + + + + + + + + + + + + + + + info + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + ${logging.path}/log_debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${logging.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log + + 10MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${logging.path}/log_info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${logging.path}/info/log-info-%d{yyyy-MM-dd}.%i.log + + 10MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${logging.path}/log_warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log + + 10MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + + ${logging.path}/log_error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.path}/error/log-error-%d{yyyy-MM-dd}.%i.log + + 10MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/ArtificialResidenceSalePriceMapper.xml b/ruoyi/src/main/resources/mybatis/data/ArtificialResidenceSalePriceMapper.xml new file mode 100644 index 000000000..e92ffc4d8 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/ArtificialResidenceSalePriceMapper.xml @@ -0,0 +1,429 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT ProjectID + ,ProjectName + ,ProjectAddr + ,County + ,Block + ,"Loop" + ,IsIndxGen + ,IsPstCalc + ,StatusRun + ,ProjectSPLabel + ,PropertyType + ,ProjectType + ,ProjectTypeDtl + ,ProjectLevel + ,Year + ,MainArea + ,AreaCoff + ,YearCoff + ,PriceNote + ,BasePriceDft + ,MainPriceDft + ,BasePrice_1 + ,PriceUnitAdj + ,Visited_Num + ,First_Visit_Time + ,Visited_Num_15 + ,Visited_Num_30 + ,PriceDealMean_1 + ,PriceDealMax_1 + ,SumDeal_1 + ,PriceDealMean + ,PriceDealMax + ,SumDeal + ,PriceListedMin + ,PriceCase1_ToAI_Pst + ,PriceCase2_ToAI_Pst + ,PriceCase1_ToLst_Pst + ,PriceCase2_ToLst_Pst + ,PriceCase1 + ,PriceCase1AdjPst + ,SumCase1 + ,PriceCase2 + ,PriceCase2AdjPst + ,SumCase2 + ,VOPPBT + ,VOPPB + ,BindProjID + ,Bind_Proj_Pst + ,Bind_Block_Class + ,Bind_Block_Class_Pst + ,Bind_Block_Plevel + ,Bind_Block_Plevel_Pst + ,Bind_Block_PType + ,Bind_Block_Ptype_Pst + ,Bind_County_PType + ,Bind_County_Ptype_Pst + ,VOPPAT + ,VOPPA + FROM dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth} + + + + + + + + + + + + + + update dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth} set + BasePrice=#{basePrice},mainPrice=#{mainPrice},BasePrice_1=#{basePrice_1},VOPPAT=#{voppat},VOPPA=#{voppa}, + PriceNote=#{comment} + where ProjectID=#{communityId}; + + + create procedure dbo.BatchImportOfArtificialResidenceSale @table DWA_PROJECTBASEPRICE_MANU_Table readonly + as + begin + insert into dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth} ( ProjectID , ProjectName , ProjectAddr , County , + Block , + Loop , IsIndxGen , IsPstCalc , StatusRun , ProjectSPLabel , PropertyType , ProjectType , ProjectTypeDtl , ProjectLevel , Year , MainArea , AreaCoff , YearCoff , PriceNote , BasePriceDft , MainPriceDft , BasePrice_1 , PriceUnitAdj , Visited_Num , First_Visit_Time , Visited_Num_15 , Visited_Num_30 , PriceDealMean_1 , PriceDealMax_1 , SumDeal_1 , PriceDealMean , PriceDealMax , SumDeal , PriceListedMin , PriceCase1_ToAI_Pst , PriceCase2_ToAI_Pst , PriceCase1_ToLst_Pst , PriceCase2_ToLst_Pst , PriceCase1 , PriceCase1AdjPst , SumCase1 , PriceCase2 , PriceCase2AdjPst , SumCase2 , VOPPBT , VOPPB , BindProjID , Bind_Proj_Pst , Bind_Block_Class , Bind_Block_Class_Pst , Bind_Block_Plevel , Bind_Block_Plevel_Pst , Bind_Block_PType , Bind_Block_Ptype_Pst , Bind_County_PType , Bind_County_Ptype_Pst , VOPPAT , VOPPA ) + select communityId , communityName , communityAddress , countyName , blockName , loopName , hasIndex , IsPstCalc , status , label , PropertyType , ProjectType , ProjectTypeDtl , propertyLevel , Year , area , areaCoefficient , yearCoefficient , comment , basePriceDraft , mainPriceDraft , BasePrice_1 , PriceUnitAdj , visitedNum , firstVisitTime , visitedNum15 , visitedNum30 , PriceDealMean_1 , PriceDealMax_1 , SumDeal_1 , PriceDealMean , PriceDealMax , SumDeal , PriceListedMin , PriceCase1_ToAI_Pst , PriceCase2_ToAI_Pst , PriceCase1_ToLst_Pst , PriceCase2_ToLst_Pst , PriceCase1 , PriceCase1AdjPst , SumCase1 , PriceCase2 , PriceCase2AdjPst , SumCase2 , VOPPBT , VOPPB , bindCommunityId , bindCommunityPst , bindBlockClass , bindBlockClassPst , bindBlockPropertyLevel , bindBlockPropertyLevelPst , bindBlockProjectType , bindBlockProjectTypePst , bindCountyProjectType , bindCountyProjectTypePst , VOPPAT , VOPPA + from @table; + end; + + + insert into dbo.DWA_PROJECTBASEPRICE_MANU_${yearMonth} + ( + ProjectID + , ProjectName + , ProjectAddr + , County + , Block + , "Loop" + , IsIndxGen + , IsPstCalc + , StatusRun + , ProjectSPLabel + , PropertyType + , ProjectType + , ProjectTypeDtl + , ProjectLevel + , Year + , MainArea + , AreaCoff + , YearCoff + , PriceNote + , BasePriceDft + , MainPriceDft + , BasePrice_1 + , PriceUnitAdj + , Visited_Num + , First_Visit_Time + , Visited_Num_15 + , Visited_Num_30 + , PriceDealMean_1 + , PriceDealMax_1 + , SumDeal_1 + , PriceDealMean + , PriceDealMax + , SumDeal + , PriceListedMin + , PriceCase1_ToAI_Pst + , PriceCase2_ToAI_Pst + , PriceCase1_ToLst_Pst + , PriceCase2_ToLst_Pst + , PriceCase1 + , PriceCase1AdjPst + , SumCase1 + , PriceCase2 + , PriceCase2AdjPst + , SumCase2 + , VOPPBT + , VOPPB + , BindProjID + , Bind_Proj_Pst + , Bind_Block_Class + , Bind_Block_Class_Pst + , Bind_Block_Plevel + , Bind_Block_Plevel_Pst + , Bind_Block_PType + , Bind_Block_Ptype_Pst + , Bind_County_PType + , Bind_County_Ptype_Pst + , VOPPAT + , VOPPA + ) + values( + #{communityId} + , #{communityName} + , #{communityAddress} + , #{countyName} + , #{blockName} + , #{loopName} + , #{hasIndex} + , #{isPstCalc} + , #{status} + , #{label} + , #{propertyType} + , #{projectType} + , #{projectTypeDtl} + , #{propertyLevel} + , #{year} + , #{area} + , #{areaCoefficient} + , #{yearCoefficient} + , #{comment} + , #{basePriceDraft} + , #{mainPriceDraft} + , #{basePrice_1} + , #{priceUnitAdj} + , #{visitedNum} + , #{firstVisitTime,jdbcType=DATE} + , #{visitedNum15} + , #{visitedNum30} + , #{priceDealMean_1} + , #{priceDealMax_1} + , #{sumDeal_1} + , #{priceDealMean} + , #{priceDealMax} + , #{sumDeal} + , #{priceListedMin} + , #{priceCase1_ToAI_Pst} + , #{priceCase2_ToAI_Pst} + , #{priceCase1_ToLst_Pst} + , #{priceCase2_ToLst_Pst} + , #{priceCase1} + , #{priceCase1AdjPst} + , #{sumCase1} + , #{priceCase2} + , #{priceCase2AdjPst} + , #{sumCase2} + , #{voppbt} + , #{voppb} + , #{bindCommunityId} + , #{bindCommunityPst} + , #{bindBlockClass} + , #{bindBlockClassPst} + , #{bindBlockPropertyLevel} + , #{bindBlockPropertyLevelPst} + , #{bindBlockProjectType} + , #{bindBlockProjectTypePst} + , #{bindCountyProjectType} + , #{bindCountyProjectTypePst} + , #{voppat} + , #{voppa} + ) + + + + insert into obpm_LianCheng_Data.dbo.TLK_基价信息 + ( + LASTMODIFIED + , FORMNAME + , AUTHOR + , AUTHOR_DEPT_INDEX + , CREATED + , FORMID + , ISTMP + , VERSIONS + , APPLICATIONID + , STATEINT + , LASTMODIFIER + , DOMAINID + , AUDITORLIST + , COAUDITORLIST + , ID + , ITEM_PriceID + , ITEM_AIRAID + , ITEM_PROJECTTYPE + , ITEM_PRICETYPE + , ITEM_STANDARDPRICE + , ITEM_MAINAREAPRICE + , ITEM_VALUEPOINT + , ITEM_PRICEEXPLAIN + , ITEM_UPDATEPERSON + , ITEM_UPDATEDATE + , ITEM_PRICECHG + ) + values( + getdate() + , N'数据维护管理/小区基价' + , N'amQRUkvYQAsAec1JGLp' + , 'Os6qe4Pmq5viTO8lTnW' + , getdate() + , N'ybte0OakLV17UzAyoVU' + , 0 + , 1 + , N'Ts7TykYmuEzzZgWhXHj' + , 0 + , N'amQRUkvYQAsAec1JGLp' + , N'BclzHtmfLQoAA5ICTb5' + , N'{}' + , N'{}' + , newid() + , newid() + , #{communityId} + , 1 + , 1 + , #{basePriceDraft} + , #{mainPriceDraft} + , #{valuePoint} + , #{comment} + , '自动生成' + , getadte() + , #{voppa} + ) + + + insert into obpm_LianCheng_Data.dbo.T_DOCUMENT + ( + ID + , LASTMODIFIED + , FORMNAME + , AUTHOR + , AUTHOR_DEPT_INDEX + , CREATED + , FORMID + , ISTMP + , VERSIONS + , APPLICATIONID + , LASTMODIFIER + , DOMAINID + , AUDITORLIST + , COAUDITORLIST + , MAPPINGID + ) + SELECT ID + , LASTMODIFIED + , FORMNAME + , AUTHOR + , AUTHOR_DEPT_INDEX + , CREATED + , FORMID + , ISTMP + , VERSIONS + , APPLICATIONID + , LASTMODIFIER + , DOMAINID + , AUDITORLIST + , COAUDITORLIST + , ID + FROM obpm_LianCheng_Data.dbo.TLK_基价信息 + where id=#{priceId} + + + update b + set b.ITEM_STANDARDPRICE = a.BasePrice_1 + , b.ITEM_MAINAREAPRICE = a.BasePrice_1 * isnull(c.AreaCoff, 1) * isnull(c.AreaCoff, 1) * isnull(c.YearCoff,1) + from DWA_PROJECTBASEPRICE_MANU_${yearMonth} a + join obpm_LianCheng_Data.dbo.TLK_基价信息 b + on a.ProjectID = b.ITEM_AIRAID + join dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth} c + on a.ProjectID = c.ProjectID + where isnull(a.BasePrice_1, 1) ]]> isnull(b.ITEM_STANDARDPRICE, 1) + and b.ITEM_VALUEPOINT = #{lastValuePoint} and a.ProjectId=#{communityId}; + + \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/data/ComputeResidenceSalePriceMapper.xml b/ruoyi/src/main/resources/mybatis/data/ComputeResidenceSalePriceMapper.xml new file mode 100644 index 000000000..44c38b7a5 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/data/ComputeResidenceSalePriceMapper.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT SID + ,ProjectID + ,ProjectName + ,ProjectAddr + ,County + ,Block + ,"Loop" + ,IsIndxGen + ,IsPstCalc + ,StatusRun + ,ProjectSPLabel + ,PropertyType + ,ProjectType + ,ProjectTypeDtl + ,ProjectLevel + ,Year + ,MainArea + ,AreaCoff + ,YearCoff + ,PriceNote + ,BasePriceDft + ,MainPriceDft + ,BasePrice_1 + ,PriceUnitAdj + ,Visited_Num + ,First_Visit_Time + ,Visited_Num_15 + ,Visited_Num_30 + ,PriceDealMean_1 + ,PriceDealMax_1 + ,SumDeal_1 + ,PriceDealMean + ,PriceDealMax + ,SumDeal + ,PriceListedMin + ,PriceCase1_ToAI_Pst + ,PriceCase2_ToAI_Pst + ,PriceCase1_ToLst_Pst + ,PriceCase2_ToLst_Pst + ,PriceCase1 + ,PriceCase1AdjPst + ,SumCase1 + ,PriceCase2 + ,PriceCase2AdjPst + ,SumCase2 + ,VOPPBT + ,VOPPB + ,BindProjID + ,Bind_Proj_Pst + ,Bind_Block_Class + ,Bind_Block_Class_Pst + ,Bind_Block_Plevel + ,Bind_Block_Plevel_Pst + ,Bind_Block_PType + ,Bind_Block_Ptype_Pst + ,Bind_County_PType + ,Bind_County_Ptype_Pst + ,VOPPAT + ,VOPPA + FROM dbo.DWA_PROJECTBASEPRICE_IMDT_${yearMonth} + + + + + + + + + + + + + + + + + + + \ 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 index da8113f96..8351a6d7e 100644 --- a/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleOpeningCaseMapper.xml +++ b/ruoyi/src/main/resources/mybatis/data/OriginalResidenceSaleOpeningCaseMapper.xml @@ -163,6 +163,145 @@ , AdjustedCumNum int , PriceTotalIn decimal(18, 2) , PriceDateIn date + , CaseType int + , RangeFlag int + ); + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + + create table ${targetTableName} + ( + SID int not null identity(1,1) + , ProjectID nvarchar(20) primary key + , ProjectName nvarchar(1024) + , ProjectAddr nvarchar(1024) + , County nvarchar(512) + , Block nvarchar(512) + , Loop nvarchar(512) + , IsIndxGen tinyint + , IsPstCalc tinyint + , StatusRun tinyint + , ProjectSPLabel nvarchar(64) + , PropertyType nvarchar(256) + , ProjectType nvarchar(256) + , ProjectTypeDtl nvarchar(256) + , ProjectLevel nvarchar(64) + , Year int + , MainArea decimal(18, 2) + , AreaCoff decimal(7, 4) + , YearCoff decimal(7, 4) + , PriceNote nvarchar(1024) + , BasePriceDft decimal(18, 2) + , MainPriceDft decimal(18, 2) + , BasePrice_1 decimal(18, 2) + , PriceUnitAdj decimal(18, 2) + , Visited_Num int + , First_Visit_Time date + , Visited_Num_15 int + , Visited_Num_30 int + , PriceDealMean_1 decimal(18, 2) + , PriceDealMax_1 decimal(18, 2) + , SumDeal_1 int + , PriceDealMean decimal(18, 2) + , PriceDealMax decimal(18, 2) + , SumDeal int + , PriceListedMin decimal(18, 2) + , PriceCase1_ToAI_Pst decimal(18, 6) + , PriceCase2_ToAI_Pst decimal(18, 6) + , PriceCase1_ToLst_Pst decimal(18, 6) + , PriceCase2_ToLst_Pst decimal(18, 6) + , PriceCase1 decimal(18, 2) + , PriceCase1AdjPst decimal(18, 6) + , SumCase1 int + , PriceCase2 decimal(18, 2) + , PriceCase2AdjPst decimal(18, 6) + , SumCase2 int + , VOPPBT varchar(64) + , VOPPB decimal(18, 6) + , BindProjID int + , Bind_Proj_Pst decimal(18, 6) + , Bind_Block_Class nvarchar(128) + , Bind_Block_Class_Pst decimal(18, 6) + , Bind_Block_Plevel nvarchar(128) + , Bind_Block_Plevel_Pst decimal(18, 6) + , Bind_Block_PType nvarchar(128) + , Bind_Block_Ptype_Pst decimal(18, 6) + , Bind_County_PType nvarchar(128) + , Bind_County_Ptype_Pst decimal(18, 6) + , VOPPAT varchar(64) + , VOPPA decimal(18, 6) + ); + + + + + + IF OBJECT_ID(#{targetTableName}, 'U') IS NOT NULL + drop table ${targetTableName}; + create table ${targetTableName} + ( + SID int not null identity(1,1) + , ProjectID nvarchar(20) primary key + , ProjectName nvarchar(1024) + , ProjectAddr nvarchar(1024) + , County nvarchar(512) + , Block nvarchar(512) + , Loop nvarchar(512) + , IsIndxGen tinyint + , IsPstCalc tinyint + , StatusRun tinyint + , ProjectSPLabel nvarchar(64) + , PropertyType nvarchar(256) + , ProjectType nvarchar(256) + , ProjectTypeDtl nvarchar(256) + , ProjectLevel nvarchar(64) + , Year int + , MainArea decimal(18, 2) + , AreaCoff decimal(7, 4) + , YearCoff decimal(7, 4) + , PriceNote nvarchar(1024) + , BasePriceDft decimal(18, 2) + , MainPriceDft decimal(18, 2) + , BasePrice_1 decimal(18, 2) + , PriceUnitAdj decimal(18, 2) + , Visited_Num int + , First_Visit_Time date + , Visited_Num_15 int + , Visited_Num_30 int + , PriceDealMean_1 decimal(18, 2) + , PriceDealMax_1 decimal(18, 2) + , SumDeal_1 int + , PriceDealMean decimal(18, 2) + , PriceDealMax decimal(18, 2) + , SumDeal int + , PriceListedMin decimal(18, 2) + , PriceCase1_ToAI_Pst decimal(18, 6) + , PriceCase2_ToAI_Pst decimal(18, 6) + , PriceCase1_ToLst_Pst decimal(18, 6) + , PriceCase2_ToLst_Pst decimal(18, 6) + , PriceCase1 decimal(18, 2) + , PriceCase1AdjPst decimal(18, 6) + , SumCase1 int + , PriceCase2 decimal(18, 2) + , PriceCase2AdjPst decimal(18, 6) + , SumCase2 int + , VOPPBT varchar(64) + , VOPPB decimal(18, 6) + , BindProjID int + , Bind_Proj_Pst decimal(18, 6) + , Bind_Block_Class nvarchar(128) + , Bind_Block_Class_Pst decimal(18, 6) + , Bind_Block_Plevel nvarchar(128) + , Bind_Block_Plevel_Pst decimal(18, 6) + , Bind_Block_PType nvarchar(128) + , Bind_Block_Ptype_Pst decimal(18, 6) + , Bind_County_PType nvarchar(128) + , Bind_County_Ptype_Pst decimal(18, 6) + , VOPPAT varchar(64) + , VOPPA decimal(18, 6) ); \ 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_residence_sale_closing_case.sql similarity index 100% rename from ruoyi/src/main/resources/sql-template/clear_closing_case.sql rename to ruoyi/src/main/resources/sql-template/clear_residence_sale_closing_case.sql diff --git a/ruoyi/src/main/resources/sql-template/clear_opening_case.sql b/ruoyi/src/main/resources/sql-template/clear_residence_sale_opening_case.sql similarity index 100% rename from ruoyi/src/main/resources/sql-template/clear_opening_case.sql rename to ruoyi/src/main/resources/sql-template/clear_residence_sale_opening_case.sql diff --git a/ruoyi/src/main/resources/sql-template/compute_residence_sale_base_price.sql b/ruoyi/src/main/resources/sql-template/compute_residence_sale_base_price.sql new file mode 100644 index 000000000..5aa6c32b7 --- /dev/null +++ b/ruoyi/src/main/resources/sql-template/compute_residence_sale_base_price.sql @@ -0,0 +1,581 @@ + /******************************小区案例整合中间表***********************************/ + insert into dbo.DW_HOUSINGCASE_COMM_#yearMonth# + ( + case_id + , HouseholdsID_LJ + , ProjectID_LJ + , ProjectID + , ProjectName + , ProjectAddr + , County + , Block + , Loop + , Roomtype + , Area + , Towards + , UpperFloorSum + , UpperFloorNum + , Elevator + , Decoration + , Year + , AreaCoff + , TowardsCoff + , FloorCoff + , DecorationRng + , YearCoff + , BuildingCoff + , BasePrice_1 + , PriceTotal + , PriceUnit + , PriceUnitAdj + , Visited_Num + , First_Visit_Time + , Visited_Num_15 + , Visited_Num_30 + , Status + , AdjustedValue + , AdjustedPst + , AdjustedCumValue + , AdjustedCumPst + , AdjustedCumValueAbs + , AdjustedCumPstAbs + , AdjustedCumNum + , PriceTotalIn + , PriceDateIn + ) +select a.case_id + , a.HouseholdsID_LJ + , a.ProjectID_LJ + , c.ITEM_AIRAID + , c.ITEM_RANAME + , c.ITEM_RAADRESS + , c.ITEM_DISTRICT1 + , c.ITEM_SECTOR121 + , c.ITEM_CIRCLEPOSITION + , a.Roomtype + , a.Area + , a.Towards + , a.UpperFloorSum + , a.UpperFloorNum + , a.Elevator + , a.Decoration + , a.Year + , isnull(a.AreaCoff, 1) + , isnull(a.TowardsCoff, 1) + , isnull(a.FloorCoff, 1) + , isnull(a.DecorationRng, 0) + , isnull(a.YearCoff, 1) + , isnull(a.BuildingCoff, 1) + , d.ITEM_STANDARDPRICE as BasePrice_1 + , a.PriceTotal + , a.PriceUnit + , a.PriceUnitAdj + , a.Visited_Num + , a.First_Visit_Time + , a.Visited_Num_15 + , a.Visited_Num_30 + , a.Status + , a.AdjustedValue + , a.AdjustedPst + , a.AdjustedCumValue + , a.AdjustedCumPst + , a.AdjustedCumValueAbs + , a.AdjustedCumPstAbs + , a.AdjustedCumNum + , a.PriceTotalIn + , a.PriceDateIn +from dbo.ODS_HOUSINGCASELISTED_LJ_#yearMonth# a + left join obpm_LianCheng_Data.dbo.TLK_链家小区 b + on a.ProjectID_LJ = b.ITEM_ProjectID_LJ + left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 c + on b.ITEM_ProjectID = c.ITEM_AIRAID + and c.ITEM_PROJECTTYPE = '1' + left join obpm_LianCheng_Data.dbo.TLK_基价信息 d + on b.ITEM_ProjectID = d.ITEM_AIRAID + and d.ITEM_PRICETYPE = '1' + and d.ITEM_PROJECTTYPE='1' + and d.ITEM_VALUEPOINT = '#valuePoint#' +where a.Status not in ( 4, 5 ); + + +insert into dbo.DW_HOUSINGCASE_COMM_#yearMonth# +( + case_id + , ProjectID + , ProjectName + , ProjectAddr + , County + , Block + , Loop + , Area + , UpperFloorSum + , UpperFloorNum + , AreaCoff + , TowardsCoff + , FloorCoff + , DecorationRng + , YearCoff + , BuildingCoff + , BasePrice_1 + , PriceTotal + , PriceUnit + , PriceUnitAdj + , Status + , PriceDateIn +) +select a.case_id + , a.ProjectID + , c.ITEM_RANAME + , c.ITEM_RAADRESS + , c.ITEM_DISTRICT1 + , c.ITEM_SECTOR121 + , c.ITEM_CIRCLEPOSITION + , a.Area + , a.UpperFloorSum + , a.UpperFloorNum + , isnull(a.AreaCoff, 1) + , 1 + , isnull(a.FloorCoff, 1) + , 0 + , 1 + , isnull(a.BuildingCoff, 1) + , d.ITEM_STANDARDPRICE as BasePrice_1 + , a.PriceTotal + , a.PriceUnit + , a.PriceUnitAdj + , NULL + , a.DateContract +from dbo.ODS_HOUSINGCASE_DEAL_#yearMonth# a + left join obpm_LianCheng_Data.dbo.TLK_小区信息管理 c + on a.ProjectID = c.ITEM_AIRAID + and c.ITEM_PROJECTTYPE = '1' + left join obpm_LianCheng_Data.dbo.TLK_基价信息 d + on a.ProjectID = d.ITEM_AIRAID + and d.ITEM_PRICETYPE = '1' + and d.ITEM_PROJECTTYPE='1' + and d.ITEM_VALUEPOINT = '#valuePoint#'; + + +---成交案例的HouseholdsID_LJ,在上期由0优化为NULL,因此RangeFlag类型需要修改 +update DW_HOUSINGCASE_COMM_#yearMonth# +set CaseType = case when HouseholdsID_LJ is null then 0 else 1 end, +RangeFlag = case when BasePrice_1 is null then 19 + when HouseholdsID_LJ is null and abs(PriceUnitAdj*1.0/BasePrice_1-1)<=0.1 then 10 + when HouseholdsID_LJ is not null and abs(PriceUnitAdj*1.0/BasePrice_1-1)<=0.06 then 10 + when abs(PriceUnitAdj*1.0/BasePrice_1-1)>0.5 then 17 + else 16 end; + +/******************************小区基价计算中间表***********************************/ +----第一步;根据小区做基础信息汇总汇总; +create table #DWA_PROJECTBASEPRICE_IMDT_STEP_1 +( + ProjectID bigint primary key + , ProjectName nvarchar(1024) + , ProjectAddr nvarchar(1024) + , County nvarchar(512) + , Block nvarchar(512) + , Loop nvarchar(512) + , IsIndxGen tinyint + , IsPstCalc tinyint + , StatusRun tinyint + , BasePrice_1 decimal(18, 2) + , PriceUnitAdj decimal(18, 2) + , Visited_Num int + , First_Visit_Time date + , Visited_Num_15 int + , Visited_Num_30 int + , PriceDealMean_1 decimal(18, 2) + , PriceDealMax_1 decimal(18, 2) + , SumDeal_1 int + , PriceDealMean decimal(18, 2) + , PriceDealMax decimal(18, 2) + , SumDeal int + , PriceListedMin decimal(18, 2) + , PriceCase1_ToAI_Pst decimal(18, 6) + , PriceCase2_ToAI_Pst decimal(18, 6) + , PriceCase1_ToLst_Pst decimal(18, 6) + , PriceCase2_ToLst_Pst decimal(18, 6) + , PriceCase1 decimal(18, 2) + , PriceCase1AdjPst decimal(18, 6) + , SumCase1 int + , PriceCase2 decimal(18, 2) + , PriceCase2AdjPst decimal(18, 6) + , SumCase2 int + , PriceCase2_ToAI_0 decimal(18, 6) --PriceCase2_ToAI_Pst非空的案例数量 + , PriceCase2_ToLst_0 decimal(18, 6) --PriceCase2_ToLst_Pst非空的案例数量 + , PriceCase2Adj_0 decimal(18, 6) --PriceCase2AdjPst非空的案例数量 +); + + +SELECT ITEM_DICTYPE,ITEM_DICVALUE,ITEM_DICTEXT +into #DICT +from obpm_LianCheng_Data.dbo.TLK_字典数据信息 +where ITEM_DICTYPE in ('板块','环线','物业类型','物业档次','区域','小区类型') + +update #DICT set ITEM_DICTEXT='浦东新区' where ITEM_DICVALUE='2' and ITEM_DICTYPE='区域'; +update #DICT set ITEM_DICTEXT='静安区' where ITEM_DICVALUE='18' and ITEM_DICTYPE='区域'; +update #DICT set ITEM_DICTEXT='黄浦区' where ITEM_DICVALUE='8' and ITEM_DICTYPE='区域'; + + +---规则修改:链家1和链家2调价幅度,status in (1,2) 都纳入计算范围 +insert into #DWA_PROJECTBASEPRICE_IMDT_STEP_1 +select + a.ITEM_AIRAID, + a.ITEM_RANAME, + a.ITEM_RAADRESS, + g.ITEM_DICTEXT, + e.ITEM_DICTEXT, + f.ITEM_DICTEXT, + a.ITEM_ISBUILDINDEX, + a.ITEM_GAINCALCULATION, + a.ITEM_RUNNINGSTATE, + d.ITEM_STANDARDPRICE, + b.PriceUnitAdj, + b.Visited_Num, + b.First_Visit_Time, + b.Visited_Num_15, + b.Visited_Num_30, + c.PriceDealMean_1, + c.PriceDealMax_1, + c.SumDeal_1, + b.PriceDealMean, + b.PriceDealMax, + b.SumDeal, + b.PriceListedMin, + b.PriceCase1_ToAI_Pst, + b.PriceCase2_ToAI_Pst, + (PriceCase1 - PriceCase1_1)*1.0/PriceCase1_1 as PriceCase1_ToLst_Pst, + (PriceCase2 - PriceCase2_1)*1.0/PriceCase2_1 as PriceCase2_ToLst_Pst, + b.PriceCase1, b.PriceCase1AdjPst, b.SumCase1, b.PriceCase2, b.PriceCase2AdjPst, b.SumCase2, + b.PriceCase2_ToAI_0, + case when b.PriceCase2_ToAI_0<>0 and c.PriceCase2_1 is not null then PriceCase2_ToAI_0 + else 0 end as PriceCase2_ToLst_0, + b.PriceCase2Adj_0 +from obpm_LianCheng_Data.dbo.TLK_小区信息管理 a +left join ( + select ProjectID, avg(BasePrice_1) as BasePrice_1, avg(PriceUnitAdj) as PriceUnitAdj, avg(Visited_Num) as Visited_Num, + min(First_Visit_Time) as First_Visit_Time, avg(Visited_Num_15) Visited_Num_15, avg(Visited_Num_30) as Visited_Num_30, + avg(case when CaseType=0 then PriceUnitAdj end) as PriceDealMean, + max(case when CaseType=0 then PriceUnitAdj end) as PriceDealMax, + count(case when CaseType=0 then 1 end) as SumDeal, + min(case when CaseType=1 then PriceUnitAdj end) as PriceListedMin, + + avg(case when RangeFlag<>19 then PriceUnitAdj end) as PriceCase1, + count(case when RangeFlag<>19 then 1 end) as SumCase1, + avg(case when RangeFlag<>19 then PriceUnitAdj end)*1.0/avg(BasePrice_1)-1 as PriceCase1_ToAI_Pst, + avg(case when RangeFlag<>19 and status in (1,2) then AdjustedPst end) as PriceCase1AdjPst, + + avg(case when RangeFlag = 10 then PriceUnitAdj end) as PriceCase2, + count(case when RangeFlag = 10 then 1 end) as SumCase2, + avg(case when RangeFlag = 10 then PriceUnitAdj end)*1.0/avg(BasePrice_1)-1 as PriceCase2_ToAI_Pst, + avg(case when RangeFlag = 10 and status in (1,2) then AdjustedPst end) as PriceCase2AdjPst, + count(case when RangeFlag = 10 then 1 end) as PriceCase2_ToAI_0, + count(case when RangeFlag = 10 and status in (1,2) then 1 end) as PriceCase2Adj_0 + from dbo.DW_HOUSINGCASE_COMM_#yearMonth# group by ProjectID +) b on a.ITEM_AIRAID = b.ProjectID +left join ( + select ProjectID, avg(case when CaseType=0 then PriceUnitAdj end) as PriceDealMean_1, + max(case when CaseType=0 then PriceUnitAdj end) as PriceDealMax_1, + count(case when CaseType=0 then 1 end) as SumDeal_1, + avg(case when RangeFlag<>19 then PriceUnitAdj end) as PriceCase1_1, + avg(case when RangeFlag = 10 then PriceUnitAdj end) as PriceCase2_1 + from dbo.DW_HOUSINGCASE_COMM_#lastYearMonth# + group by ProjectID +) c on a.ITEM_AIRAID = c.ProjectID +left join obpm_LianCheng_Data.dbo.TLK_基价信息 d on a.ITEM_AIRAID = d.ITEM_AIRAID and d.ITEM_PROJECTTYPE='1' and d.ITEM_PRICETYPE='1' +left JOIN #DICT e on A.ITEM_SECTOR121=E.ITEM_DICVALUE and E.ITEM_DICTYPE='板块' +left JOIN #DICT f on A.ITEM_CIRCLEPOSITION=f.ITEM_DICVALUE and f.ITEM_DICTYPE='环线' +left JOIN #DICT g on A.ITEM_DISTRICT1=g.ITEM_DICVALUE and g.ITEM_DICTYPE='区域' +where a.ITEM_PROJECTTYPE='1' and d.ITEM_VALUEPOINT='#valuePoint#'; + +----第二步;根据案例自动计算的小区涨跌幅 +create table #DWA_PROJECTBASEPRICE_IMDT_STEP_2 +( + ProjectID bigint primary key + , VOPPBT int --价格涨跌幅类型-调整前 + , VOPPB decimal(18, 6)--价格涨跌幅-调整前 +); + +INSERT INTO #DWA_PROJECTBASEPRICE_IMDT_STEP_2 +SELECT a.ProjectID, + CASE WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 11 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 12 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 13 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 14 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 15 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 16 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 17 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 18 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN 19 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 21 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 22 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 23 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 24 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0 + AND (PriceCase2_ToAI_0<>0 OR PriceCase2_ToLst_0<>0 OR PriceCase2Adj_0<>0)) THEN 25 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 26 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 27 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 28 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN 29 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 0 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 32 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 33 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 34 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 35 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 36 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 37 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 38 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN 39 + END AS VOPPBT, + CASE WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN MIN --11 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN MDN*1.0/4 --12 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN MDN*1.0/4 --13 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN MDN*1.0/4 --14 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 0 --15 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN 0 --16 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN MDN*1.0/4 --17 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 0 --18 + WHEN (PriceCase2_ToAI_Pst>0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN MDN --19 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN MDN*1.0/4 --21 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN MDN*1.0/4 --22 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN 0 --23 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 0 --24 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0 + AND (PriceCase2_ToAI_0<>0 OR PriceCase2_ToLst_0<>0 OR PriceCase2Adj_0<>0)) THEN 0 --25 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN MIN*1.0/3 --26 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN 0 --27 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN 0 --28 + WHEN (PriceCase2_ToAI_Pst=0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN MDN --29 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst>0) THEN 0 --31 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst=0) THEN 0 --32 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst>0 AND PriceCase2AdjPst<0) THEN MDN --33 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst>0) THEN 0 --34 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst=0) THEN 0 --35 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst=0 AND PriceCase2AdjPst<0) THEN MDN --36 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst>0) THEN MDN --37 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst=0) THEN MDN --38 + WHEN (PriceCase2_ToAI_Pst<0 AND PriceCase2_ToLst_Pst<0 AND PriceCase2AdjPst<0) THEN MDN --39 + END AS VOPPB +FROM (SELECT projectid, ISNULL(PriceCase2_ToAI_Pst,0) PriceCase2_ToAI_Pst, + ISNULL(PriceCase2_ToLst_Pst,0) PriceCase2_ToLst_Pst, ISNULL(PriceCase2AdjPst,0) PriceCase2AdjPst, + PriceCase2_ToAI_0, PriceCase2_ToLst_0, PriceCase2Adj_0 + FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_1 where PriceUnitAdj is not null) a +LEFT JOIN ( + select projectid, min(vl) as MIN, avg(MDN) as MDN + from ( + select projectid, tp, vl, PERCENTILE_CONT(0.5) within group(order by vl)over(partition by projectid) as MDN --取中位数 + from ( + select projectid, PriceCase2_ToAI_Pst, PriceCase2_ToLst_Pst, PriceCase2AdjPst + from #DWA_PROJECTBASEPRICE_IMDT_STEP_1 where PriceUnitAdj is not null + ) as t unpivot(vl for tp in (PriceCase2_ToAI_Pst, PriceCase2_ToLst_Pst, PriceCase2AdjPst)) as up + )tt group by projectid +)b ON a.projectid = b.projectid; + +----第三步;计算绑定涨跌幅 +-----2019.11.12规则新增:对于绑定没有推导出、且上周期有价格的小区,沿用上周期价格 +create table #DWA_PROJECTBASEPRICE_IMDT_STEP_3 +( + ProjectID bigint primary key + , BindProjID int + , Bind_Proj_Pst decimal(18, 6) + , Bind_Block_Class nvarchar(128) + , Bind_Block_Class_Pst decimal(18, 6) + , Bind_Block_Plevel nvarchar(128) + , Bind_Block_Plevel_Pst decimal(18, 6) + , Bind_Block_PType nvarchar(128) + , Bind_Block_PType_Pst decimal(18, 6) + , Bind_County_PType nvarchar(128) + , Bind_County_PType_Pst decimal(18, 6) + , Bind_Price_1_PType nvarchar(128) + , Bind_Price_1_PType_Pst decimal(18, 6) + , VOPPAT varchar(64) + , VOPPA decimal(18, 6) +); + +-- 1.绑定ID (注意:对于上期基价为空的小区,不参与涨跌幅推导) +SELECT +A.ITEM_AIRAID as ProjectId, +e.ITEM_DICTEXT as Block, +g.ITEM_DICTEXT as County, +h.ITEM_DICTEXT as PROPERTYLEVEL, +A.ITEM_ProjectTypeDtl as PROJECTTYPEDTL, +A.ITEM_BindClassID as BINDCLASSID, +B.ProjectID AS BindProjID, +B.VOPPB AS Bind_Proj_Pst, +CASE + when C.ProjectID IS NOT NULL THEN C.VOPPBT + WHEN B.ProjectID IS NOT NULL AND D.ITEM_STANDARDPRICE IS NOT NULL THEN '8505' END AS VOPPAT, +CASE + when C.ProjectID IS NOT NULL THEN C.VOPPB + WHEN B.ProjectID IS NOT NULL AND D.ITEM_STANDARDPRICE IS NOT NULL THEN B.VOPPB END AS VOPPA, +D.ITEM_STANDARDPRICE as BasePrice +INTO #TempBindProjID +FROM obpm_LianCheng_Data.dbo.TLK_小区信息管理 A +LEFT JOIN (SELECT ProjectID, VOPPBT, VOPPB FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_2 WHERE ABS(VOPPB) < 0.1) B + on a.item_BindProjID = B.ProjectID +LEFT JOIN (SELECT ProjectID, VOPPBT, VOPPB FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_2 WHERE ABS(VOPPB) < 0.1) C + on A.item_airaid = C.ProjectID +left join obpm_LianCheng_Data.dbo.TLK_基价信息 d + on a.ITEM_AIRAID = d.ITEM_AIRAID + and d.ITEM_PRICETYPE = '1' + and d.ITEM_PROJECTTYPE = '1' + and a.ITEM_PROJECTTYPE=d.ITEM_PROJECTTYPE +left join #DICT e on e.ITEM_DICTYPE='板块' and e.ITEM_DICVALUE=a.ITEM_SECTOR121 +left JOIN #DICT g on g.ITEM_DICTYPE='区域' and A.ITEM_DISTRICT1=g.ITEM_DICVALUE +left JOIN #DICT h on h.ITEM_DICTYPE='物业档次' and A.ITEM_PROPERTYLEVEL=h.ITEM_DICVALUE +where a.ITEM_PROJECTTYPE='1' and d.ITEM_VALUEPOINT = '#valuePoint#' + +-- 判断小区是否有效 + +-- 2.板块+绑定 +SELECT A.ProjectId, A.Block, A.County, A.PROPERTYLEVEL, A.PROJECTTYPEDTL, A.BINDCLASSID, A.BindProjID, A.Bind_Proj_Pst, + B.Bind_Block_Class, B.Bind_Block_Class_Pst, + CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT + WHEN B.Bind_Block_Class IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8501' END AS VOPPAT, + CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA + WHEN B.Bind_Block_Class IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_Block_Class_Pst END AS VOPPA, + A.BasePrice +INTO #Temp_Bind_Block_Class +FROM #TempBindProjID A +LEFT JOIN ( + SELECT Block+BindClassID AS Bind_Block_Class, AVG(VOPPA) AS Bind_Block_Class_Pst + FROM #TempBindProjID GROUP BY Block+BindClassID +) B +ON A.Block +A.BindClassID = B.Bind_Block_Class AND B.Bind_Block_Class_Pst IS NOT NULL + + +-- 3.板块+物业档次 +SELECT A.ProjectID, A.Block, A.County, A.PROPERTYLEVEL, A.ProjectTypeDtl, A.BindClassID, A.BindProjID, A.Bind_Proj_Pst, + A.Bind_Block_Class, A.Bind_Block_Class_Pst, B.Bind_Block_Plevel, B.Bind_Block_Plevel_Pst, + CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT + WHEN B.Bind_Block_Plevel IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8502' END AS VOPPAT, + CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA + WHEN B.Bind_Block_Plevel IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_Block_Plevel_Pst END AS VOPPA, + A.BasePrice +INTO #Temp_Bind_Block_Plevel +FROM #Temp_Bind_Block_Class A +LEFT JOIN ( + SELECT Block+PROPERTYLEVEL AS Bind_Block_Plevel, AVG(VOPPA) AS Bind_Block_Plevel_Pst + FROM #Temp_Bind_Block_Class GROUP BY Block+PROPERTYLEVEL +) B +ON A.Block +A.PROPERTYLEVEL = B.Bind_Block_Plevel AND B.Bind_Block_Plevel_Pst IS NOT NULL +-- 4.板块+物业类型 +SELECT A.ProjectID, A.Block, A.County, A.PROPERTYLEVEL, A.ProjectTypeDtl, A.BindClassID, A.BindProjID, A.Bind_Proj_Pst, + A.Bind_Block_Class, A.Bind_Block_Class_Pst, A.Bind_Block_Plevel, A.Bind_Block_Plevel_Pst, + B.Bind_Block_PType, B.Bind_Block_PType_Pst, + CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT + WHEN B.Bind_Block_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8503' END AS VOPPAT, + CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA + WHEN B.Bind_Block_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_Block_PType_Pst END AS VOPPA, + A.BasePrice +INTO #Temp_Bind_Block_PType +FROM #Temp_Bind_Block_Plevel A +LEFT JOIN ( + SELECT Block+ProjectTypeDtl AS Bind_Block_PType, AVG(VOPPA) AS Bind_Block_PType_Pst + FROM #Temp_Bind_Block_Plevel GROUP BY Block+ProjectTypeDtl +) B +ON A.Block+A.ProjectTypeDtl = B.Bind_Block_PType AND B.Bind_Block_PType_Pst IS NOT NULL +-- 5.区域+物业类型 +SELECT A.ProjectID, A.Block, A.County, A.PROPERTYLEVEL, A.ProjectTypeDtl, A.BindClassID, A.BindProjID, A.Bind_Proj_Pst, + A.Bind_Block_Class, A.Bind_Block_Class_Pst, A.Bind_Block_Plevel, A.Bind_Block_Plevel_Pst, + A.Bind_Block_PType, A.Bind_Block_PType_Pst, B.Bind_County_PType, B.Bind_County_PType_Pst, + CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT + WHEN B.Bind_County_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN '8504' END AS VOPPAT, + CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA + WHEN B.Bind_County_PType IS NOT NULL AND A.BasePrice IS NOT NULL THEN B.Bind_County_PType_Pst END AS VOPPA, + A.BasePrice +INTO #Temp_Bind_County_PType +FROM #Temp_Bind_Block_PType A +LEFT JOIN ( + SELECT County+ProjectTypeDtl AS Bind_County_PType, AVG(VOPPA) AS Bind_County_PType_Pst + FROM #Temp_Bind_Block_PType GROUP BY County+ProjectTypeDtl +) B +ON A.County +A.ProjectTypeDtl = B.Bind_County_PType AND B.Bind_County_PType_Pst IS NOT NULL + +--插入结果 (11-39 自动计算; 8505 绑定相同ID平均值; 8506混合小区ID; 8501板块+绑定; 8502板块+物业档次; 8503板块+类型; 8504区域+类型) +--6. 上周期有基价、当周期没有涨跌幅的的小区,沿用上周期基价 +INSERT INTO #DWA_PROJECTBASEPRICE_IMDT_STEP_3 +SELECT ProjectID, BindProjID, Bind_Proj_Pst, + Bind_Block_Class, Bind_Block_Class_Pst, Bind_Block_Plevel, Bind_Block_Plevel_Pst, + Bind_Block_PType, Bind_Block_PType_Pst, Bind_County_PType, Bind_County_PType_Pst, + '沿用上周期基价' as Bind_Price_1_PType, 0 as Bind_Price_1_PType_Pst, + CASE WHEN A.VOPPAT IS NOT NULL THEN A.VOPPAT + WHEN A.BasePrice IS NOT NULL THEN '9999' END AS VOPPAT, + CASE WHEN A.VOPPA IS NOT NULL THEN A.VOPPA + WHEN A.BasePrice IS NOT NULL THEN 0 END AS VOPPA +FROM #Temp_Bind_County_PType A + + +DROP TABLE #TempBindProjID +DROP TABLE #Temp_Bind_Block_Class +DROP TABLE #Temp_Bind_Block_Plevel +DROP TABLE #Temp_Bind_Block_PType +DROP TABLE #Temp_Bind_County_PType + + +----第四步;基价中间表的其他字段,包括主力基价的修正系数等等 +create table #DWA_PROJECTBASEPRICE_IMDT_STEP_4 +( + ProjectID bigint primary key + , ProjectSPLabel nvarchar(64) + , PropertyType nvarchar(256) + , ProjectType nvarchar(256) + , ProjectTypeDtl nvarchar(256) + , ProjectLevel nvarchar(64) + , Year int + , MainArea decimal(18, 2) + , AreaCoff decimal(7, 4) + , YearCoff decimal(7, 4) + , PriceNote nvarchar(1024) +); + +INSERT INTO #DWA_PROJECTBASEPRICE_IMDT_STEP_4 +select A.ITEM_AIRAID + , A.ITEM_RALABLE + , e.ITEM_DICTEXT + , g.ITEM_DICTEXT + , A.ITEM_PROJECTTYPEDTL + , h.ITEM_DICTEXT + , A.ITEM_MAINCOMPLETIONYEAR + , A.ITEM_MAINAREA + , A.ITEM_AREACOFF + , A.ITEM_YEARCOFF + , D.ITEM_PRICEEXPLAIN +from obpm_LianCheng_Data.dbo.TLK_小区信息管理 A + left join obpm_LianCheng_Data.dbo.TLK_基价信息 D + on A.ITEM_AIRAID = D.ITEM_AIRAID + and A.ITEM_PROJECTTYPE = D.ITEM_PROJECTTYPE + and a.ITEM_PROJECTTYPE=d.ITEM_PROJECTTYPE + and D.ITEM_VALUEPOINT = '#valuePoint#' + left join #DICT e on e.ITEM_DICTYPE='物业类型' and e.ITEM_DICVALUE=a.ITEM_RAPROPERTYTYPE + left JOIN #DICT g on g.ITEM_DICTYPE='小区类型' and A.ITEM_RATYPE=g.ITEM_DICVALUE + left JOIN #DICT h on h.ITEM_DICTYPE='物业档次' and A.ITEM_PROPERTYLEVEL=h.ITEM_DICVALUE +where A.ITEM_PROJECTTYPE = '1' + and D.ITEM_PROJECTTYPE = '1' + and D.ITEM_PRICETYPE = '1'; + +----第五步;整合到结果表 +INSERT INTO DWA_PROJECTBASEPRICE_IMDT_#yearMonth# +SELECT A.ProjectID, A.ProjectName, A.ProjectAddr, A.County, A.Block, A.Loop, a.IsIndxGen, a.IsPstCalc, a.StatusRun, D.ProjectSPLabel, D.PropertyType, D.ProjectType, + D.ProjectTypeDtl, D.ProjectLevel, D.[Year], D.MainArea, ISNULL(D.AreaCoff,1), ISNULL(D.YearCoff,1), D.PriceNote, + A.BasePrice_1*(1+C.VOPPA) AS BasePriceDft, + A.BasePrice_1*(1+C.VOPPA)*ISNULL(D.AreaCoff,1)*ISNULL(D.YearCoff,1) AS MainPriceDft, + A.BasePrice_1, A.PriceUnitAdj, A.Visited_Num, A.First_Visit_Time, A.Visited_Num_15, A.Visited_Num_30, + A.PriceDealMean_1, A.PriceDealMax_1, A.SumDeal_1, A.PriceDealMean, A.PriceDealMax, A.SumDeal, + A.PriceListedMin, A.PriceCase1_ToAI_Pst, A.PriceCase2_ToAI_Pst, A.PriceCase1_ToLst_Pst, A.PriceCase2_ToLst_Pst, + A.PriceCase1, A.PriceCase1AdjPst, A.SumCase1, A.PriceCase2, A.PriceCase2AdjPst, A.SumCase2, B.VOPPBT, B.VOPPB, + C.BindProjID, C.Bind_Proj_Pst, C.Bind_Block_Class, C.Bind_Block_Class_Pst, C.Bind_Block_Plevel, C.Bind_Block_Plevel_Pst, + C.Bind_Block_PType, C.Bind_Block_PType_Pst, C.Bind_County_PType, C.Bind_County_PType_Pst, C.VOPPAT, C.VOPPA +FROM #DWA_PROJECTBASEPRICE_IMDT_STEP_1 A +LEFT JOIN #DWA_PROJECTBASEPRICE_IMDT_STEP_2 B +ON A.ProjectID = B.ProjectID +LEFT JOIN #DWA_PROJECTBASEPRICE_IMDT_STEP_3 C +ON A.ProjectID = C.ProjectID +LEFT JOIN #DWA_PROJECTBASEPRICE_IMDT_STEP_4 D +ON A.ProjectID = D.ProjectID; + +drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_1; +drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_2; +drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_3; +drop table #DWA_PROJECTBASEPRICE_IMDT_STEP_4; +drop table #DICT; \ No newline at end of file diff --git a/ruoyi/src/main/resources/sql-template/init.sql b/ruoyi/src/main/resources/sql-template/init.sql new file mode 100644 index 000000000..9c02e67fb --- /dev/null +++ b/ruoyi/src/main/resources/sql-template/init.sql @@ -0,0 +1,62 @@ + +create type DWA_PROJECTBASEPRICE_MANU_Table as table +( + communityId nvarchar(20) null , + communityName nvarchar(200) null , + communityAddress nvarchar(1024) null , + countyName nvarchar(200) null , + blockName nvarchar(200) null , + loopName nvarchar(200) null , + hasIndex int null , + isPstCalc int null , + status int null , + label nvarchar(200) null , + propertyType nvarchar(200) null , + projectType nvarchar(200) null , + projectTypeDtl nvarchar(200) null , + propertyLevel nvarchar(200) null , + year int null , + area decimal(18, 2) null , + areaCoefficient decimal(7, 4) null , + yearCoefficient decimal(7, 4) null , + comment nvarchar(1024) null , + basePriceDraft decimal(18, 2) null , + mainPriceDraft decimal(18, 2) null , + basePrice_1 decimal(18, 2) null , + voppat nvarchar(200) null , + voppa decimal(18, 2) null , + priceUnitAdj decimal(18, 2) null , + visitedNum int null , + firstVisitTime date null , + visitedNum15 int null , + visitedNum30 int null , + priceDealMean_1 decimal(18, 2) null , + priceDealMax_1 decimal(18, 2) null , + sumDeal_1 int null , + priceDealMean decimal(18, 2) null , + priceDealMax decimal(18, 2) null , + sumDeal int null , + priceListedMin decimal(18, 2) null , + priceCase1_ToAI_Pst decimal(18, 6) null , + priceCase2_ToAI_Pst decimal(18, 6) null , + priceCase1_ToLst_Pst decimal(18, 6) null , + priceCase2_ToLst_Pst decimal(18, 6) null , + priceCase1 decimal(18, 2) null , + priceCase1AdjPst decimal(18, 6) null , + sumCase1 int null , + priceCase2 decimal(18, 2) null , + priceCase2AdjPst decimal(18, 6) null , + sumCase2 int null , + voppbt nvarchar(200) null , + voppb decimal(18, 6) null , + bindCommunityId int null , + bindCommunityPst decimal(18, 6) null , + bindBlockClass nvarchar(200) null , + bindBlockClassPst decimal(18, 6) null , + bindBlockPropertyLevel nvarchar(200) null , + bindBlockPropertyLevelPst decimal(18, 6) null , + bindBlockProjectType nvarchar(200) null , + bindBlockProjectTypePst decimal(18, 6) null , + bindCountyProjectType nvarchar(200) null , + bindCountyProjectTypePst decimal(18, 6) null +) \ No newline at end of file diff --git a/ruoyi/src/test/java/com/uvaluation/GenerateTableTests.java b/ruoyi/src/test/java/com/uvaluation/GenerateTableTests.java new file mode 100644 index 000000000..f6ca418dd --- /dev/null +++ b/ruoyi/src/test/java/com/uvaluation/GenerateTableTests.java @@ -0,0 +1,71 @@ +package com.uvaluation; + + +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; +import org.junit.Test; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class GenerateTableTests { + + @Test + public void getELTableColumn() { + Class targetClass = ComputeResidenceSaleBasePrice.class; + + Stream.of(targetClass.getDeclaredFields()).forEach(x -> { + if (x.isAnnotationPresent(com.ruoyi.framework.aspectj.lang.annotation.Excel.class)) { + com.ruoyi.framework.aspectj.lang.annotation.Excel excel = + x.getAnnotation(com.ruoyi.framework.aspectj.lang.annotation.Excel.class); + System.out.println(String.format("", excel.name(), x.getName())); + } + }); + } + + @Test + public void generateUserTableType() { + Class targetClass = ComputeResidenceSaleBasePrice.class; + Stream.of(targetClass.getDeclaredFields()).forEach(x -> { + if (x.isAnnotationPresent(com.ruoyi.framework.aspectj.lang.annotation.Excel.class)) { + if ("java.lang.String".equals(x.getType().getName())) + System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + + ".NVARCHAR);", x.getName())); + else if ("java.lang.Integer".equals(x.getType().getName())) + System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + + ".INT);", x.getName())); + else if ("java.math.BigDecimal".equals(x.getType().getName())) + System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + + ".DECIMAL);", x.getName())); + else if ("java.util.Date".equals(x.getType().getName())) + System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + + ".DATE);", x.getName())); + } + }); + } + + @Test + public void generateUserTableScript() { + Class targetClass = ComputeResidenceSaleBasePrice.class; + Stream.of(targetClass.getDeclaredFields()).forEach(x -> { + if (x.isAnnotationPresent(com.ruoyi.framework.aspectj.lang.annotation.Excel.class)) { + System.out.println(x.getName() + ","); +// System.out.println(x.getName() + " nvarchar(200) null ,"); +// if ("java.lang.String".equals(x.getType().getName())) +// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + +// ".NVARCHAR);", x.getName())); +// else if ("java.lang.Integer".equals(x.getType().getName())) +// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + +// ".INT);", x.getName())); +// else if ("java.math.BigDecimal".equals(x.getType().getName())) +// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + +// ".DECIMAL);", x.getName())); +// else if ("java.util.Date".equals(x.getType().getName())) +// System.out.println(String.format("sourceDataTable.addColumnMetadata(\"%s\", java.sql.Types" + +// ".DATE);", x.getName())); + } + }); + } +} diff --git a/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java b/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java index 8a7d73d14..fb583b153 100644 --- a/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java +++ b/ruoyi/src/test/java/com/uvaluation/compute/ResidenceSaleBasePriceTests.java @@ -3,11 +3,18 @@ package com.uvaluation.compute; import com.ruoyi.RuoYiApplication; import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleClosingCaseService; import com.ruoyi.project.data.cases.service.IOriginalResidenceSaleOpeningCaseService; +import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice; +import com.ruoyi.project.data.price.service.IArtificialResidenceSalePriceService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.LinkedList; +import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest(classes = RuoYiApplication.class) @@ -16,6 +23,8 @@ public class ResidenceSaleBasePriceTests { @Autowired private IOriginalResidenceSaleOpeningCaseService originalResidenceOpeningCaseService; @Autowired + private IArtificialResidenceSalePriceService artificialResidenceSalePriceService; + @Autowired private IOriginalResidenceSaleClosingCaseService originalResidenceClosingCaseService; @Test @@ -28,5 +37,14 @@ public class ResidenceSaleBasePriceTests { originalResidenceClosingCaseService.pullData(); } + @Test + public void testBatchImport() { + List list = new LinkedList<>(); + ComputeResidenceSaleBasePrice computeResidenceSaleBasePrice = new ComputeResidenceSaleBasePrice(); + computeResidenceSaleBasePrice.setCommunityId("10101"); + computeResidenceSaleBasePrice.setBasePriceDraft(new BigDecimal(12222)); + list.add(computeResidenceSaleBasePrice); + artificialResidenceSalePriceService.batchImport(202007, list); + } }