|
|
|
@ -1,14 +1,21 @@
|
|
|
|
|
package com.air.housing.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import com.air.applets.dto.BlocksPreSaleTotalDto; |
|
|
|
|
import com.air.housing.dto.BlockListDto; |
|
|
|
|
import com.air.housing.entity.AnnoBlocksRel; |
|
|
|
|
import com.air.housing.entity.Blocks; |
|
|
|
|
import com.air.housing.mapper.AnnoBlocksRelMapper; |
|
|
|
|
import com.air.housing.mapper.BlocksMapper; |
|
|
|
|
import com.air.housing.service.BlocksService; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 楼栋信息 |
|
|
|
@ -17,13 +24,57 @@ import javax.annotation.Resource;
|
|
|
|
|
* @date 2021-05-18 09:39:45 |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class BlocksServiceImpl extends ServiceImpl<BlocksMapper, Blocks> implements BlocksService { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BlocksMapper blocksMapper; |
|
|
|
|
|
|
|
|
|
private AnnoBlocksRelMapper annoBlocksRelMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Page<Blocks> getBlocksPageByhousingEstateId(Page page, BlockListDto blockListDto) { |
|
|
|
|
return blocksMapper.getBlocksPageByhousingEstateId(page, blockListDto); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Page<Blocks> getBlocksPageByhousingEstateId(Page page,BlockListDto blockListDto) { |
|
|
|
|
public BlocksPreSaleTotalDto getPreSaleTotal(String landListId) { |
|
|
|
|
// 合计预售,合计去化
|
|
|
|
|
BlocksPreSaleTotalDto saleInfo = baseMapper.getSaleInfo(landListId); |
|
|
|
|
if (saleInfo.getPreSaleTotal() > 0) { |
|
|
|
|
//计算去化率
|
|
|
|
|
BigDecimal destroyTotal = new BigDecimal(saleInfo.getDestroyTotal()); |
|
|
|
|
BigDecimal preSaleTotal = new BigDecimal(saleInfo.getPreSaleTotal()); |
|
|
|
|
saleInfo.setDestroyTotalRate(destroyTotal.divide(preSaleTotal, 2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 住宅均价
|
|
|
|
|
BigDecimal preSaleHousePrice = baseMapper.getHouseAvgPrice(1); |
|
|
|
|
//商业均价
|
|
|
|
|
BigDecimal preSaleBusinessPrice = baseMapper.getHouseAvgPrice(2); |
|
|
|
|
saleInfo.setPreSaleHousePrice(preSaleHousePrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
saleInfo.setPreSaleBusinessPrice(preSaleBusinessPrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
return saleInfo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return blocksMapper.getBlocksPageByhousingEstateId(page,blockListDto); |
|
|
|
|
@Override |
|
|
|
|
public List<BlocksPreSaleTotalDto> getPreSaleDetailList(String landListedId) { |
|
|
|
|
//获取楼盘id
|
|
|
|
|
AnnoBlocksRel annoBlocksRel = annoBlocksRelMapper.selectOne(Wrappers.<AnnoBlocksRel>query().lambda() |
|
|
|
|
.eq(AnnoBlocksRel::getLandListedId, landListedId).eq(AnnoBlocksRel::getMainLand, 1)); |
|
|
|
|
if (annoBlocksRel == null) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<BlocksPreSaleTotalDto> saleTotalDtoList = baseMapper.getHouseSaleInfo(annoBlocksRel.getHousingEstatesId()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(saleTotalDtoList)) { |
|
|
|
|
saleTotalDtoList.forEach(saleInfo -> { |
|
|
|
|
if (saleInfo.getPreSaleTotal() > 0) { |
|
|
|
|
//计算去化率
|
|
|
|
|
BigDecimal destroyTotal = new BigDecimal(saleInfo.getDestroyTotal()); |
|
|
|
|
BigDecimal preSaleTotal = new BigDecimal(saleInfo.getPreSaleTotal()); |
|
|
|
|
saleInfo.setDestroyTotalRate(destroyTotal.divide(preSaleTotal, 2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return saleTotalDtoList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|