feat(每月作价):迁移住宅租赁基价

1. 计算、修正、最终租赁基价页面查询;
2. 导入、导出、修改、从作价数据导入;
3. 页面功能划分优化;
4. 修改路由规则
This commit is contained in:
purple
2020-06-22 18:09:42 +08:00
parent 0cb32a7463
commit 5e11233226
26 changed files with 934 additions and 586 deletions

View File

@ -1,17 +0,0 @@
package com.ruoyi.project.data.price.controller;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
public class ComputeResidenceSaleBasePriceController {
}

View File

@ -1,6 +1,8 @@
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;
@ -26,12 +28,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@RestController
@RequestMapping("/data/rentprice/residence")
@RequestMapping("/data/rent-price/residence/")
public class ResidenceRentBasePriceController extends BaseController {
@Autowired
private IComputeResidenceRentPriceService computeResidenceRentPriceService;
@ -49,15 +49,15 @@ public class ResidenceRentBasePriceController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/compute/list")
public TableDataInfo list(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
public TableDataInfo computeList(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
int pageIndex = ServletUtils.getParameterToInt("pageIndex");
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
computeResidenceRentBasePrice.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
computeResidenceRentBasePrice.setPageSize(pageSize);
int total = computeResidenceRentPriceService.selectCount(computeResidenceRentBasePrice);
int total = computeResidenceRentPriceService.selectPageCount(computeResidenceRentBasePrice);
List<ComputeResidenceRentBasePrice> list =
computeResidenceRentPriceService.selectList(computeResidenceRentBasePrice);
computeResidenceRentPriceService.selectPageList(computeResidenceRentBasePrice);
list.forEach(x -> x.setYearMonth(computeResidenceRentBasePrice.getYearMonth()));
return getDataTable(list, total);
}
@ -67,9 +67,8 @@ public class ResidenceRentBasePriceController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/compute/yearmonth")
public AjaxResult yearMonthList() {
public AjaxResult computeYearMonthList() {
List<VueSelectModel> list = computeResidenceRentPriceService.getYearMonth();
return AjaxResult.success(list);
}
@ -79,70 +78,59 @@ public class ResidenceRentBasePriceController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = "/compute/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(computeResidenceRentPriceService.selectById(id));
}
/**
* 修改 住宅租赁基价
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "住宅租赁基价", businessType = BusinessType.UPDATE)
@PutMapping(value = "/compute")
public AjaxResult edit(@RequestBody ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
return toAjax(computeResidenceRentPriceService.update(computeResidenceRentBasePrice));
}
/**
* 导出 住宅租赁基价列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "办公基价", businessType = BusinessType.EXPORT)
@Log(title = "住宅租赁基价", businessType = BusinessType.EXPORT)
@GetMapping("/compute/export")
public AjaxResult export(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
int total = computeResidenceRentPriceService.selectCount(computeResidenceRentBasePrice);
int total = computeResidenceRentPriceService.selectPageCount(computeResidenceRentBasePrice);
computeResidenceRentBasePrice.setPageIndex(0);
computeResidenceRentBasePrice.setPageSize(total);
List<ComputeResidenceRentBasePrice> list =
computeResidenceRentPriceService.selectList(computeResidenceRentBasePrice);
computeResidenceRentPriceService.selectPageList(computeResidenceRentBasePrice);
ExcelUtil<ComputeResidenceRentBasePrice> util = new ExcelUtil<>(ComputeResidenceRentBasePrice.class);
return util.exportExcel(list, "住宅租赁基价");
}
/**
* 办公基价导入
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "办公基价", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/compute/importData")
public AjaxResult importData(@RequestParam("id") String id, @RequestParam("module") String module,
MultipartFile file) throws Exception {
ExcelUtil<ComputeResidenceRentBasePrice> util = new ExcelUtil<>(ComputeResidenceRentBasePrice.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(id);
uploadFile.setSaveFileName(fileName);
uploadFile.setFileName(file.getOriginalFilename());
uploadFile.setModuleName(module);
uploadFile.setCreateBy(operName);
fileService.insert(uploadFile);
// List<ComputeResidenceRentBasePrice> computeResidenceRentBasePrices = util.importExcel(file.getInputStream());
// String message = computeResidenceRentPriceService.batchImport(computeResidenceRentBasePrices, operName);
return AjaxResult.success("not implement");
/**
* 查询 人工修正住宅租赁 表名
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/artificial/yearmonth")
public AjaxResult artificialYearMonthList() {
List<VueSelectModel> list = artificialResidenceRentPriceService.getYearMonth();
return AjaxResult.success(list);
}
/**
* 人工修正住宅租赁
* 查询 人工修正住宅租赁
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/artificial/{yearMonth}/{id}")
public AjaxResult artificialById(@PathVariable("yearMonth") Integer yearMonth, @PathVariable("id") String id) {
ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice =
artificialResidenceRentPriceService.selectById(yearMonth, id);
return AjaxResult.success(artificialResidenceRentBasePrice);
}
/**
* 修改 住宅租赁基价
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "人工修正住宅租赁基价", businessType = BusinessType.UPDATE)
@PutMapping(value = "/artificial")
public AjaxResult artificialEdit(@RequestBody ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice) {
return toAjax(artificialResidenceRentPriceService.update(artificialResidenceRentBasePrice));
}
/**
* 查询 人工修正住宅租赁
*
* @param artificialResidenceRentBasePrice
* @return
@ -162,9 +150,81 @@ public class ResidenceRentBasePriceController extends BaseController {
return getDataTable(list, total);
}
/**
* 导出 住宅租赁基价列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "人工修正住宅租赁基价", businessType = BusinessType.EXPORT)
@GetMapping("/artificial/export")
public AjaxResult artificialExport(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice) {
int total = artificialResidenceRentPriceService.selectCount(artificialResidenceRentBasePrice);
artificialResidenceRentBasePrice.setPageIndex(0);
artificialResidenceRentBasePrice.setPageSize(total);
List<ArtificialResidenceRentBasePrice> list =
artificialResidenceRentPriceService.selectList(artificialResidenceRentBasePrice);
ExcelUtil<ArtificialResidenceRentBasePrice> util = new ExcelUtil<>(ArtificialResidenceRentBasePrice.class);
return util.exportExcel(list, "人工修正住宅租赁基价" + artificialResidenceRentBasePrice.getYearMonth());
}
// 文件保存
/**
* 导入 人工修正住宅租赁基价
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "住宅租赁基价", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/artificial/import/{yearMonth}")
public AjaxResult importData(@PathVariable("yearMonth") Integer yearMonth,
MultipartFile file) throws Exception {
ExcelUtil<ComputeResidenceRentBasePrice> util = new ExcelUtil<>(ComputeResidenceRentBasePrice.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<ComputeResidenceRentBasePrice> artificialResidenceSaleBasePrices = util.importExcel(file.getInputStream
());
if (StringUtils.isNull(artificialResidenceSaleBasePrices) || artificialResidenceSaleBasePrices.size() == 0) {
throw new CustomException("人工修正住宅销售基价不能为空!");
}
String message = artificialResidenceRentPriceService.batchImport(yearMonth, artificialResidenceSaleBasePrices);
return AjaxResult.success(message);
}
/**
* 同步作价数据
*
* @param yearMonth
* @return
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/artificial/importSync/{yearMonth}")
public AjaxResult artificialImportBySync(@PathVariable Integer yearMonth) {
artificialResidenceRentPriceService.importBySync(yearMonth);
return AjaxResult.success();
}
/**
* 查询 最终住宅租赁 表名
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/ultimate/yearmonth")
public AjaxResult ultimateYearMonthList() {
List<VueSelectModel> list = ultimateResidenceRentBasePriceService.getYearMonth();
return AjaxResult.success(list);
}
/**
* 查询 住宅租赁基价列表
@ -184,30 +244,6 @@ public class ResidenceRentBasePriceController extends BaseController {
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));
}
/**
* 导出 住宅租赁基价列表
*/
@ -223,5 +259,4 @@ public class ResidenceRentBasePriceController extends BaseController {
ExcelUtil<UltimateResidenceRentBasePrice> util = new ExcelUtil<>(UltimateResidenceRentBasePrice.class);
return util.exportExcel(list, "核准住宅租赁基价");
}
}

View File

@ -163,7 +163,7 @@ public class ResidenceSaleBasePriceController extends BaseController {
* @return
* @throws Exception
*/
@Log(title = "办公基价", businessType = BusinessType.IMPORT)
@Log(title = "住宅售价基价", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/artificial/importData/{yearMonth}")
public AjaxResult importData(@PathVariable("yearMonth") Integer yearMonth,

View File

@ -4,6 +4,7 @@ import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 人工修正住宅租赁对象
@ -37,6 +38,20 @@ public class ArtificialResidenceRentBasePrice extends BaseEntity {
@Excel(name = "价格涨跌幅-调整后")
private BigDecimal voppa;
/**
* 价值时点
*/
private Date valuePoint;
/**
* 上期价值时点
*/
private Date lastValuePoint;
/**
* 价格id随机生成
*/
private String priceId;
public Integer getYearMonth() {
return yearMonth;
}
@ -124,4 +139,28 @@ public class ArtificialResidenceRentBasePrice extends BaseEntity {
public void setVoppa(BigDecimal voppa) {
this.voppa = voppa;
}
public Date getValuePoint() {
return valuePoint;
}
public void setValuePoint(Date valuePoint) {
this.valuePoint = valuePoint;
}
public Date getLastValuePoint() {
return lastValuePoint;
}
public void setLastValuePoint(Date lastValuePoint) {
this.lastValuePoint = lastValuePoint;
}
public String getPriceId() {
return priceId;
}
public void setPriceId(String priceId) {
this.priceId = priceId;
}
}

View File

@ -1,7 +1,10 @@
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.ArtificialResidenceRentBasePrice;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -14,7 +17,53 @@ import java.util.List;
@DS("compute")
public interface ArtificialResidenceRentPriceMapper {
List<ArtificialResidenceRentBasePrice> selectArtificialResidenceRentBasePriceList(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice);
/**
* 单条记录
*
* @param id
* @return
*/
ArtificialResidenceRentBasePrice selectById(@Param("yearMonth") Integer yearMonth, @Param("id") String id);
Integer selectArtificialResidenceRentBasePriceListCount(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice);
}
List<ArtificialResidenceRentBasePrice> selectPageList(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice);
Integer selectPageCount(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice);
/**
* @return
*/
List<VueSelectModel> yearMonthList();
/**
* 从作价数据拷贝数据到人工修正
* 先删除原数据,然后再插入。
*
* @param yearMonth
* @return
*/
int importBySync(@Param("yearMonth") Integer yearMonth);
/**
* 清空数据
*
* @param yearMonth
* @return
*/
int clearData(@Param("yearMonth") Integer yearMonth);
/**
* 更新
*
* @param artificialResidenceRentBasePrice
* @return
*/
int update(ArtificialResidenceRentBasePrice artificialResidenceRentBasePrice);
/**
* 创建用于批量导入的存储过程
*
* @param yearMonth
* @return
*/
int prepareBachImport(@Param("yearMonth") Integer yearMonth);
}

View File

@ -56,15 +56,6 @@ public interface ArtificialResidenceSaleBasePriceMapper {
*/
int prepareBachImport(@Param("yearMonth") Integer yearMonth);
// /**
// * 修改数据
// *
// * @param artificialResidenceSaleBasePrice
// * @return
// */
// int updatePrice(ArtificialResidenceSaleBasePrice artificialResidenceSaleBasePrice);
/**
* 分页列表
*

View File

@ -14,12 +14,12 @@ public interface ComputeResidenceRentPriceMapper {
* @param id
* @return
*/
ComputeResidenceRentBasePrice selectComputeResidenceRentBasePriceById(String id);
ComputeResidenceRentBasePrice selectById(String id);
/**
* 查询列表
*/
List<ComputeResidenceRentBasePrice> selectComputeResidenceRentBasePriceList(ComputeResidenceRentBasePrice ComputeResidenceRentBasePrice);
List<ComputeResidenceRentBasePrice> selectPageList(ComputeResidenceRentBasePrice ComputeResidenceRentBasePrice);
/**
* 求和
@ -27,7 +27,7 @@ public interface ComputeResidenceRentPriceMapper {
* @param ComputeResidenceRentBasePrice
* @return
*/
Integer selectComputeResidenceRentBasePriceListCount(ComputeResidenceRentBasePrice ComputeResidenceRentBasePrice);
Integer selectPageCount(ComputeResidenceRentBasePrice ComputeResidenceRentBasePrice);
/**
* 更新

View File

@ -1,6 +1,7 @@
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.ArtificialResidenceRentBasePrice;
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
import com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice;
@ -16,20 +17,13 @@ import java.util.List;
@DS("compute")
public interface UltimateResidenceRentPriceMapper {
List<UltimateResidenceRentBasePrice> selectPageList(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
List<UltimateResidenceRentBasePrice> selectListByRoute(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
Integer selectCountByRoute(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
Integer selectPageCount(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
/**
* @param id
* @return
*/
UltimateResidenceRentBasePrice selectByRoute(Integer id);
List<VueSelectModel> yearMonthList();
/**
* @param ultimateResidenceRentBasePrice
* @return
*/
int updateByRoute(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.project.data.price.service;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice;
import com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,6 +15,15 @@ import java.util.List;
*/
public interface IArtificialResidenceRentPriceService {
/**
* 单条记录
*
* @param yearMonth
* @param id
* @return
*/
ArtificialResidenceRentBasePrice selectById(Integer yearMonth, String id);
/**
* 查询人工修正住宅租赁列表
*
@ -26,7 +38,33 @@ public interface IArtificialResidenceRentPriceService {
*/
int selectCount(ArtificialResidenceRentBasePrice officeBasePriceUltimate);
/**
* 获取表名
*
* @return
*/
List<VueSelectModel> getYearMonth();
/**
* @param yearMonth
*/
void importBySync(Integer yearMonth);
/**
* 更新
* @param officeBasePriceUltimate
* @return
*/
int update(ArtificialResidenceRentBasePrice officeBasePriceUltimate);
/**
* 导入
*
* @param yearMonth
* @param list
* @return
*/
String batchImport(Integer yearMonth, List<ComputeResidenceRentBasePrice> list);
}

View File

@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 【请填写功能名称】Service接口
* Service接口
*
* @author ruoyi
* @date 2020-05-20
@ -16,18 +16,18 @@ import java.util.List;
public interface IComputeResidenceRentPriceService {
/**
* 查询【请填写功能名称】列表
* 查询列表
*
* @param officeBasePriceUltimate 【请填写功能名称】
* @return 【请填写功能名称】集合
* @param officeBasePriceUltimate
* @return 集合
*/
List<ComputeResidenceRentBasePrice> selectList(ComputeResidenceRentBasePrice officeBasePriceUltimate);
List<ComputeResidenceRentBasePrice> selectPageList(ComputeResidenceRentBasePrice officeBasePriceUltimate);
/**
* @param officeBasePriceUltimate
* @return
*/
int selectCount(ComputeResidenceRentBasePrice officeBasePriceUltimate);
int selectPageCount(ComputeResidenceRentBasePrice officeBasePriceUltimate);
/**
* @param id
@ -35,19 +35,6 @@ public interface IComputeResidenceRentPriceService {
*/
ComputeResidenceRentBasePrice selectById(String id);
/**
* @param officeBasePriceUltimate
* @return
*/
int update(ComputeResidenceRentBasePrice officeBasePriceUltimate);
/**
* @param officeBasePriceUltimates
* @param operName
* @return
*/
String batchImport(List<ComputeResidenceRentBasePrice> officeBasePriceUltimates, String operName);
/**
* 获取表名
*

View File

@ -1,24 +1,36 @@
package com.ruoyi.project.data.price.service;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice;
import com.ruoyi.project.data.price.domain.ComputeResidenceSaleBasePrice;
import com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice;
import java.util.List;
/**
* @author ruoyi
* @date 2020-05-20
* 住宅租赁基价
*/
public interface IUltimateResidenceRentBasePriceService {
/**
* @param ultimateResidenceRentBasePrice
* @return
*/
List<UltimateResidenceRentBasePrice> selectList(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
/**
* @param ultimateResidenceRentBasePrice
* @return
*/
int selectCount(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
UltimateResidenceRentBasePrice selectById(Integer id);
/**
* 获取表名
*
* @return
*/
List<VueSelectModel> getYearMonth();
int update(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice);
String batchImport(List<UltimateResidenceRentBasePrice> ultimateResidenceRentBasePrices, String operName);
}

View File

@ -1,22 +1,37 @@
package com.ruoyi.project.data.price.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.microsoft.sqlserver.jdbc.SQLServerCallableStatement;
import com.microsoft.sqlserver.jdbc.SQLServerDataTable;
import com.microsoft.sqlserver.jdbc.SQLServerException;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice;
import com.ruoyi.project.data.price.domain.ArtificialResidenceSaleBasePrice;
import com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice;
import com.ruoyi.project.data.price.mapper.ArtificialResidenceRentPriceMapper;
import com.ruoyi.project.data.price.service.IArtificialResidenceRentPriceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* 【请填写功能名称】Service业务层处理
* Service业务层处理
*
* @author ruoyi
* @date 2020-05-20
*/
@Service
@DS("compute")
public class ArtificialResidenceRentPriceServiceImpl implements IArtificialResidenceRentPriceService {
private static final Logger log = LoggerFactory.getLogger(ArtificialResidenceRentPriceServiceImpl.class);
@ -24,16 +39,134 @@ public class ArtificialResidenceRentPriceServiceImpl implements IArtificialResid
@Autowired
private ArtificialResidenceRentPriceMapper artificialResidenceRentPriceMapper;
@Override
public ArtificialResidenceRentBasePrice selectById(Integer yearMonth, String id) {
ArtificialResidenceRentBasePrice residenceRentBasePrice =
artificialResidenceRentPriceMapper.selectById(yearMonth, id);
residenceRentBasePrice.setYearMonth(yearMonth);
return residenceRentBasePrice;
}
@Override
public List<ArtificialResidenceRentBasePrice> selectList(ArtificialResidenceRentBasePrice
ArtificialResidenceRentPrice) {
return artificialResidenceRentPriceMapper.selectArtificialResidenceRentBasePriceList
(ArtificialResidenceRentPrice);
ArtificialResidenceRentPrice) {
return artificialResidenceRentPriceMapper.selectPageList
(ArtificialResidenceRentPrice);
}
@Override
public int selectCount(ArtificialResidenceRentBasePrice ArtificialResidenceRentPrice) {
return artificialResidenceRentPriceMapper.selectArtificialResidenceRentBasePriceListCount
(ArtificialResidenceRentPrice);
return artificialResidenceRentPriceMapper.selectPageCount
(ArtificialResidenceRentPrice);
}
@Override
public List<VueSelectModel> getYearMonth() {
return artificialResidenceRentPriceMapper.yearMonthList();
}
@Override
@Transactional
public void importBySync(Integer yearMonth) {
artificialResidenceRentPriceMapper.clearData(yearMonth);
artificialResidenceRentPriceMapper.importBySync(yearMonth);
}
@Override
public int update(ArtificialResidenceRentBasePrice officeBasePriceUltimate) {
return artificialResidenceRentPriceMapper.update(officeBasePriceUltimate);
}
/**
* 批量导入
*
* @param yearMonth
* @param computeResidenceRentBasePrices
* @return
*/
@Override
public String batchImport(Integer yearMonth, List<ComputeResidenceRentBasePrice> computeResidenceRentBasePrices) {
int successNum = computeResidenceRentBasePrices.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();
artificialResidenceRentPriceMapper.prepareBachImport(yearMonth);
CopyOnWriteArrayList<ArtificialResidenceRentBasePrice> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
computeResidenceRentBasePrices.parallelStream().forEach(inputModel -> {
ArtificialResidenceRentBasePrice artificialResidenceSaleBasePrice =
new ArtificialResidenceRentBasePrice();
BeanUtils.copyProperties(inputModel,
artificialResidenceSaleBasePrice);
artificialResidenceSaleBasePrice.setYearMonth(yearMonth);
artificialResidenceSaleBasePrice.setPriceId(UUID.randomUUID().toString());
artificialResidenceSaleBasePrice.setValuePoint(valuePoint);
artificialResidenceSaleBasePrice.setLastValuePoint(lastValuePoint);
copyOnWriteArrayList.add(artificialResidenceSaleBasePrice);
});
Date today = new Date();
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("ProjectID", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("MainCoff_Rent", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("RentPrice", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("MainRentPrice", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("RentPrice_1", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("VOPPAT", java.sql.Types.NVARCHAR);
sourceDataTable.addColumnMetadata("VOPPA", java.sql.Types.DECIMAL);
sourceDataTable.addColumnMetadata("ModifyDate", java.sql.Types.DATE);
copyOnWriteArrayList.forEach(x -> {
try {
sourceDataTable.addRow(
x.getCommunityId(),
x.getMainRentCoefficient(),
x.getRentPrice(),
x.getMainRentPrice(),
x.getRentPrice_1(),
x.getVoppat(),
x.getVoppa(),
today
);
} catch (SQLServerException e) {
e.printStackTrace();
}
});
Statement statement = conn.createStatement();
try (CallableStatement cs = conn.prepareCall("{CALL dbo.BatchImportOfArtificialResidenceRent (?)}")) {
((SQLServerCallableStatement) cs).setStructured(1, "dbo.DWA_PROJECTBASEPRICE_RENT_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 BatchImportOfArtificialResidenceRent");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
StringBuilder successMsg = new StringBuilder("恭喜您,数据已全部导入成功!共 " + (successNum - failureNum) + "");
return successMsg.toString();
}
}

View File

@ -86,7 +86,6 @@ public class ArtificialResidenceSalePriceServiceImpl implements IArtificialResid
}
@Override
// @Transactional
public String batchImport(Integer yearMonth, List<ComputeResidenceSaleBasePrice> list) {
int successNum = list.size();

View File

@ -11,12 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
/**
* 【请填写功能名称】Service业务层处理
*
* @author ruoyi
* @date 2020-05-20
*/
@Service
public class ComputeResidenceRentPriceServiceImpl implements IComputeResidenceRentPriceService {
@ -26,32 +21,24 @@ public class ComputeResidenceRentPriceServiceImpl implements IComputeResidenceRe
private ComputeResidenceRentPriceMapper computeResidenceRentPriceMapper;
@Override
public List<ComputeResidenceRentBasePrice> selectList(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
return computeResidenceRentPriceMapper.selectComputeResidenceRentBasePriceList(computeResidenceRentBasePrice);
public List<ComputeResidenceRentBasePrice> selectPageList(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
return computeResidenceRentPriceMapper.selectPageList(computeResidenceRentBasePrice);
}
@Override
public int selectCount(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
return computeResidenceRentPriceMapper.selectComputeResidenceRentBasePriceListCount(computeResidenceRentBasePrice);
public int selectPageCount(ComputeResidenceRentBasePrice computeResidenceRentBasePrice) {
return computeResidenceRentPriceMapper.selectPageCount(computeResidenceRentBasePrice);
}
@Override
public ComputeResidenceRentBasePrice selectById(String id) {
return computeResidenceRentPriceMapper.selectComputeResidenceRentBasePriceById(id);
}
@Override
public int update(ComputeResidenceRentBasePrice officeBasePriceUltimate) {
return 0;
}
@Override
public String batchImport(List<ComputeResidenceRentBasePrice> officeBasePriceUltimates, String operName) {
return null;
return computeResidenceRentPriceMapper.selectById(id);
}
@Override
public List<VueSelectModel> getYearMonth() {
return computeResidenceRentPriceMapper.yearMonthList();
}
}

View File

@ -1,9 +1,10 @@
package com.ruoyi.project.data.price.service.impl;
import com.ruoyi.project.common.VueSelectModel;
import com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice;
import com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice;
import com.ruoyi.project.data.price.mapper.UltimateResidenceRentPriceMapper;
import com.ruoyi.project.data.price.service.IUltimateResidenceRentBasePriceService;
import com.ruoyi.project.system.service.impl.SysUserServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,26 +28,18 @@ public class UltimateResidenceRentBasePriceServiceImpl implements IUltimateResid
@Override
public List<UltimateResidenceRentBasePrice> selectList(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice) {
return ultimateResidenceRentPriceMapper.selectListByRoute(ultimateResidenceRentBasePrice);
return ultimateResidenceRentPriceMapper.selectPageList(ultimateResidenceRentBasePrice);
}
@Override
public int selectCount(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice) {
return ultimateResidenceRentPriceMapper.selectCountByRoute(ultimateResidenceRentBasePrice);
return ultimateResidenceRentPriceMapper.selectPageCount(ultimateResidenceRentBasePrice);
}
@Override
public UltimateResidenceRentBasePrice selectById(Integer id) {
return ultimateResidenceRentPriceMapper.selectByRoute(id);
public List<VueSelectModel> getYearMonth() {
return ultimateResidenceRentPriceMapper.yearMonthList();
}
@Override
public int update(UltimateResidenceRentBasePrice ultimateResidenceRentBasePrice) {
return ultimateResidenceRentPriceMapper.updateByRoute(ultimateResidenceRentBasePrice);
}
@Override
public String batchImport(List<UltimateResidenceRentBasePrice> ultimateResidenceRentBasePrices, String operName) {
return null;
}
}

View File

@ -14,24 +14,70 @@
<result property="rentPrice_1" column="rentPrice_1"/>
<result property="voppat" column="voppat"/>
<result property="voppa" column="voppa"/>
<result property="yearMonth" column="yearMonth"/>
</resultMap>
<select id="selectArtificialResidenceRentBasePriceListCount"
<select id="selectById" resultMap="MainMappingResult">
select * from DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth} where id=#{id};
</select>
<select id="selectPageCount"
parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice" resultType="int">
select count(1) from DWA_PROJECTBASEPRICE_RENT_IMDT_${yearMonth}
select count(1) from DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth}
<where>
<if test="communityId != null">
AND ProjectID = #{communityId}
ProjectID like concat('%',#{communityId},'%')
</if>
</where>
</select>
<!-- 分页 -->
<select id="selectArtificialResidenceRentBasePriceList"
<select id="selectPageList"
parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice"
resultMap="MainMappingResult">
<![CDATA[ SELECT ID,ProjectID,MainCoff_Rent,RentPrice,MainRentPrice,RentPrice_1,VOPPAT,VOPPA ]]>
FROM dbo.DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth}
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
SELECT ID,ProjectID,MainCoff_Rent,RentPrice,MainRentPrice,RentPrice_1,VOPPAT,VOPPA
FROM dbo.DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth}
<where>
<if test="communityId != null">
ProjectID like concat('%',#{communityId},'%')
</if>
</where>
order by ProjectID ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only
</select>
<!-- 获取表名 -->
<select id="yearMonthList" resultType="com.ruoyi.project.common.VueSelectModel">
SELECT right(name,6) as value, right(name,6) as label
FROM sys.tables
where name like 'DWA_PROJECTBASEPRICE_RENT_MANU_%' and name not like '%_bak'
order by cast(right(name,6) as int) desc
</select>
<!-- 从计算作价中同步数据到人工修正表 -->
<update id="importBySync">
insert into dbo.DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth}
(ProjectID,MainCoff_Rent,RentPrice,MainRentPrice,RentPrice_1,VOPPAT,VOPPA,ModifyDate)
SELECT ProjectID,MainCoff_Rent,RentPriceDft,MainRentPriceDft,RentPrice_1,VOPPAT,VOPPA,getdate()
from dbo.DWA_PROJECTBASEPRICE_RENT_IMDT_${yearMonth};
</update>
<!-- 清空人工修正表-->
<update id="clearData">
truncate table DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth};
</update>
<!-- 更新人工修正租赁基价-->
<update id="update" parameterType="com.ruoyi.project.data.price.domain.ArtificialResidenceRentBasePrice">
update dbo.DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth}
set RentPrice=#{rentPrice},MainRentPrice=#{mainRentPrice},VOPPAT=#{voppat},VOPPA=#{voppa},RentPrice_1=#{rentPrice_1}
,ModifyDate=getdate()
where ID=#{id}
</update>
<!-- 创建存储过程-->
<update id="prepareBachImport" parameterType="int">
create procedure dbo.BatchImportOfArtificialResidenceRent @table DWA_PROJECTBASEPRICE_RENT_MANU_Table readonly
as
begin
insert into dbo.DWA_PROJECTBASEPRICE_RENT_MANU_${yearMonth}(ProjectID,MainCoff_Rent,RentPrice,MainRentPrice,RentPrice_1,VOPPAT,VOPPA,ModifyDate )
select ProjectID,MainCoff_Rent,RentPrice,MainRentPrice,RentPrice_1,VOPPAT,VOPPA,ModifyDate
from @table;
end;
</update>
</mapper>

View File

@ -130,7 +130,7 @@
FROM dbo.DWA_PROJECTBASEPRICE_RENT_IMDT_${yearMonth}
</sql>
<select id="selectComputeResidenceRentBasePriceListCount"
<select id="selectPageCount"
parameterType="com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice" resultType="int">
select count(1) from DWA_PROJECTBASEPRICE_RENT_IMDT_${yearMonth}
<where>
@ -140,7 +140,7 @@
</where>
</select>
<!-- 分页 -->
<select id="selectComputeResidenceRentBasePriceList"
<select id="selectPageList"
parameterType="com.ruoyi.project.data.price.domain.ComputeResidenceRentBasePrice"
resultMap="MainMappingResult">
<![CDATA[ SELECT ID,ProjectID,ProjectName,ProjectAddr,County,Block,[Loop] as loopLine,IsIndxGen,IsPstCalc,StatusRun,PropertyType,ProjectType,ProjectTypeDtl,ProjectLevel,PropertyDevPeriod,BindClassID,MainCoff_Rent,RentPriceDft,MainRentPriceDft,RentPrice_1,PriceDealMean_1,PriceDealMax_1,SumDeal_1,PriceDeal_1_ToAI_Pst,PriceDealMean,PriceDealMax,SumDeal,PriceDeal_ToAI_Pst,PriceDeal_ToLst_Pst,PriceCaseOff,PriceCaseOff_ToLst_Pst,PriceListedMin,PriceLstMn_ToAI_Pst,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,Bind_MixProject_PType,Bind_MixProject_Pst,VOPPAT,VOPPA ]]>
@ -149,7 +149,7 @@
</select>
<!-- -->
<select id="selectComputeResidenceRentBasePriceById" parameterType="String" resultMap="MainMappingResult">
<select id="selectById" parameterType="String" resultMap="MainMappingResult">
<include refid="selectOfficeBasePriceUltimateVo"/>
where id = #{id}
</select>
@ -161,11 +161,4 @@
order by cast(right(name,6) as int) desc
</select>
<!-- <update id="updateComputeResidenceRentBasePrice" parameterType="com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice">-->
<!-- update TLK_计价办公核准基价 set ITEM_YEARMONTH=ITEM_YEARMONTH-->
<!-- <trim prefix="SET" suffixOverrides=",">-->
<!-- </trim>-->
<!-- where id = #{id}-->
<!-- </update>-->
</mapper>

View File

@ -37,7 +37,7 @@
from ODS_PROJECT_RENT_PRICE_INFO_${yearMonth}
</sql>
<select id="selectCountByRoute" parameterType="com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice" resultType="int">
<select id="selectPageCount" parameterType="com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice" resultType="int">
select count(1) from ODS_PROJECT_RENT_PRICE_INFO_${yearMonth}
<where>
<if test="communityId != null">
@ -49,7 +49,7 @@
</where>
</select>
<select id="selectListByRoute" parameterType="com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice"
<select id="selectPageList" parameterType="com.ruoyi.project.data.price.domain.UltimateResidenceRentBasePrice"
resultMap="MappingResult">
<include refid="selectAllColumn"/>
<where>
@ -62,4 +62,11 @@
</where>
order by ProjectID ASC, status DESC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only;
</select>
<select id="yearMonthList" resultType="com.ruoyi.project.common.VueSelectModel">
SELECT right(name,6) as value, right(name,6) as label
FROM sys.tables
where name like 'ODS_PROJECT_RENT_PRICE_INFO_%' and name not like '%_bak'
order by cast(right(name,6) as int) desc
</select>
</mapper>