Browse Source

2.0.0 修改报表导入提示

feature/v.2.0.0
peihao 3 years ago
parent
commit
4b08cf2171
  1. 90
      air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java
  2. 2
      air/src/main/java/com/air/utils/ExcelUtil.java

90
air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java

@ -112,55 +112,59 @@ public class LandListedServiceImpl extends ServiceImpl<LandListedMapper, LandLis
dataList = ExcelUtil.importExcel(file.getInputStream(), 0, 1, 0, LandListed.class, "config/landListed-config.json"); dataList = ExcelUtil.importExcel(file.getInputStream(), 0, 1, 0, LandListed.class, "config/landListed-config.json");
} catch (Exception e) { } catch (Exception e) {
log.error("导入已挂牌地块数据出错", e); log.error("导入已挂牌地块数据出错", e);
throw new BusinessException("导入已挂牌地块数据出错"); throw new BusinessException(e.getMessage());
} }
if (CollectionUtil.isNotEmpty(dataList)) { if (CollectionUtil.isNotEmpty(dataList)) {
dataList.forEach(landListed -> { try {
landListed.setLandListedId(DateUtil.landListedIdfromDate(LocalDateTime.now(), "yyyyMMdd", this.selectId())); dataList.forEach(landListed -> {
//土地出让面积,计算土地出让面积(亩)(出让面积/2000*3) landListed.setLandListedId(DateUtil.landListedIdfromDate(LocalDateTime.now(), "yyyyMMdd", this.selectId()));
BigDecimal landTransferSquare = landListed.getLandTransferSquare(); //土地出让面积,计算土地出让面积(亩)(出让面积/2000*3)
if (landTransferSquare != null) { BigDecimal landTransferSquare = landListed.getLandTransferSquare();
landListed.setLandTransferMu(landTransferSquare.divide(new BigDecimal(2000), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(3)).setScale(0, BigDecimal.ROUND_HALF_UP));
}
//总建筑面积
BigDecimal totalConsArea = landListed.getTotalConsArea();
//成交价(万元)
BigDecimal dealPrice = null;
//出让价款起始价(万元)
BigDecimal transferPrice = null;
if (totalConsArea != null) {
//计算容积率(总建筑面积/土地出让面积)
if (landTransferSquare != null) { if (landTransferSquare != null) {
landListed.setPlotRatio(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : totalConsArea.divide(landTransferSquare, 2, BigDecimal.ROUND_HALF_UP)); landListed.setLandTransferMu(landTransferSquare.divide(new BigDecimal(2000), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(3)).setScale(0, BigDecimal.ROUND_HALF_UP));
} }
//出让价款起始价(万元),计算起始楼面价(元/㎡) (出让价款起始价/总建筑面积*10000) //总建筑面积
transferPrice = landListed.getTransferPrice(); BigDecimal totalConsArea = landListed.getTotalConsArea();
if (transferPrice != null) { //成交价(万元)
landListed.setStartingFloorPrice((transferPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0) BigDecimal dealPrice = null;
? new BigDecimal(0) : transferPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP) //出让价款起始价(万元)
.multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP)); BigDecimal transferPrice = null;
if (totalConsArea != null) {
//计算容积率(总建筑面积/土地出让面积)
if (landTransferSquare != null) {
landListed.setPlotRatio(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : totalConsArea.divide(landTransferSquare, 2, BigDecimal.ROUND_HALF_UP));
}
//出让价款起始价(万元),计算起始楼面价(元/㎡) (出让价款起始价/总建筑面积*10000)
transferPrice = landListed.getTransferPrice();
if (transferPrice != null) {
landListed.setStartingFloorPrice((transferPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0)
? new BigDecimal(0) : transferPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP));
}
//商业面积,商务面积
BigDecimal bizSpace = landListed.getBizSpace() == null ? new BigDecimal(0) : landListed.getBizSpace();
BigDecimal commerceSpace = landListed.getCommerceSpace() == null ? new BigDecimal(0) : landListed.getCommerceSpace();
//计算商业商务占比((商业面积+商务面积)/总建筑面积)
landListed.setBizCommerceRate(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : (bizSpace.add(commerceSpace)).
divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
//成交价(万元),计算成交楼面价(元/㎡) (成交价/总建筑面积*10000)
dealPrice = landListed.getDealPrice();
if (dealPrice != null) {
landListed.setDealFloorPrice((dealPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0)
? new BigDecimal(0) : dealPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP));
}
} }
//商业面积,商务面积 //计算溢价率
BigDecimal bizSpace = landListed.getBizSpace() == null ? new BigDecimal(0) : landListed.getBizSpace(); if (dealPrice != null && transferPrice != null) {
BigDecimal commerceSpace = landListed.getCommerceSpace() == null ? new BigDecimal(0) : landListed.getCommerceSpace(); landListed.setPremiumRate((dealPrice.doubleValue() == 0 || transferPrice.doubleValue() == 0)
//计算商业商务占比((商业面积+商务面积)/总建筑面积) ? new BigDecimal(0) : (dealPrice.subtract(transferPrice)).divide(transferPrice, 4, BigDecimal.ROUND_HALF_UP)
landListed.setBizCommerceRate(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : (bizSpace.add(commerceSpace)). .multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
//成交价(万元),计算成交楼面价(元/㎡) (成交价/总建筑面积*10000)
dealPrice = landListed.getDealPrice();
if (dealPrice != null) {
landListed.setDealFloorPrice((dealPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0)
? new BigDecimal(0) : dealPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP));
} }
} });
//计算溢价率 } catch (Exception e) {
if (dealPrice != null && transferPrice != null) { log.error("数据计算出错:",e);
landListed.setPremiumRate((dealPrice.doubleValue() == 0 || transferPrice.doubleValue() == 0) }
? new BigDecimal(0) : (dealPrice.subtract(transferPrice)).divide(transferPrice, 4, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
}
});
} }
return this.saveBatch(dataList); return this.saveBatch(dataList);
} }

2
air/src/main/java/com/air/utils/ExcelUtil.java

@ -155,7 +155,7 @@ public class ExcelUtil {
map.put(excelConfig.getFieldName(), value); map.put(excelConfig.getFieldName(), value);
} catch (Exception e) { } catch (Exception e) {
log.error("解析出错:", e); log.error("解析出错:", e);
throw new BusinessException("第" + i + "行,第" + excelConfig.getFieldName() + "列数据解析出现错误"); throw new BusinessException("第" + (i+1) + "行,第" + excelConfig.getTitleName() + "列数据解析出现错误");
} }
} }
mapList.add(map); mapList.add(map);

Loading…
Cancel
Save