Browse Source

1.0.0 修改小程序楼盘信息,新增小程序地图显示接口

feature/v1.0.0
peihao 4 years ago
parent
commit
999e4ff236
  1. 12
      air/src/main/java/com/air/applets/controller/AppletsMapController.java
  2. 33
      air/src/main/java/com/air/applets/controller/BlocksController.java
  3. 6
      air/src/main/java/com/air/applets/dto/BlocksPreSaleTotalDto.java
  4. 8
      air/src/main/java/com/air/applets/mapper/AppletsMapMapper.java
  5. 7
      air/src/main/java/com/air/applets/serivce/AppletsMapService.java
  6. 11
      air/src/main/java/com/air/applets/serivce/impl/AppletsMapServiceImpl.java
  7. 12
      air/src/main/java/com/air/housing/mapper/BlocksMapper.java
  8. 10
      air/src/main/java/com/air/housing/service/BlocksService.java
  9. 59
      air/src/main/java/com/air/housing/service/impl/BlocksServiceImpl.java
  10. 6
      air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java
  11. 4
      air/src/main/java/com/air/land/entity/LandListedLonLat.java
  12. 5
      air/src/main/java/com/air/land/entity/LandToListLonLat.java
  13. 14
      air/src/main/resources/mapper/AppletsMapMapper.xml
  14. 39
      air/src/main/resources/mapper/BlocksMapper.xml

12
air/src/main/java/com/air/applets/controller/AppletsMapController.java

@ -11,7 +11,10 @@ import com.cinderella.framework.common.core.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -22,6 +25,7 @@ import java.util.List;
* @author peihao
* @date 2021-05-18 09:39:59
*/
@RestController
@RequestMapping("/applets/map")
@Api(value = "appletsMap", tags = "小程序地图显示")
public class AppletsMapController {
@ -100,7 +104,7 @@ public class AppletsMapController {
*/
@ApiOperation(value = "获取挂牌中数据", notes = "获取挂牌中数据")
@GetMapping("getLandListing")
public R<List<LandToListLonLat>> getLandListing() {
public R<List<LandListedLonLat>> getLandListing() {
return R.ok(mapService.getLandListing(), "查询成功");
}
@ -111,8 +115,8 @@ public class AppletsMapController {
*/
@ApiOperation(value = "获取出让地块数据", notes = "获取出让地块数据")
@GetMapping("getLandList")
public R<List<LandListedLonLat>> getLandList() {
return R.ok(mapService.getLandList(), "查询成功");
public R<List<LandListedLonLat>> getLandList(@RequestParam String star, @RequestParam String end) {
return R.ok(mapService.getLandList(star, end), "查询成功");
}
}

33
air/src/main/java/com/air/applets/controller/BlocksController.java

@ -1,6 +1,5 @@
package com.air.applets.controller;
import cn.hutool.core.date.DateUtil;
import com.air.applets.dto.BlocksPreSaleTotalDto;
import com.air.housing.service.BlocksService;
import com.cinderella.framework.common.core.util.R;
@ -12,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -34,43 +31,25 @@ public class BlocksController {
/**
* 销售情况统计
*
* @param landListedId 已挂牌地块id
* @param transactionStatus 交易状态
* @param landListedId 已挂牌地块id
* @return R
*/
@ApiOperation(value = "销售情况统计", notes = "销售情况统计")
@GetMapping("getPreSaleTotal")
public R<BlocksPreSaleTotalDto> getPreSaleTotal(@RequestParam String landListedId, String transactionStatus) {
BlocksPreSaleTotalDto preSaleTotalDto = new BlocksPreSaleTotalDto();
preSaleTotalDto.setPreSaleTotal(200);
preSaleTotalDto.setDestroyTotal(58);
preSaleTotalDto.setDestroyTotalRate(25.6d);
preSaleTotalDto.setPreSaleBusinessPrice(13555.6);
preSaleTotalDto.setPreSaleHousePrice(15680.2);
return R.ok(preSaleTotalDto);
public R<BlocksPreSaleTotalDto> getPreSaleTotal(@RequestParam String landListedId) {
return R.ok(blocksService.getPreSaleTotal(landListedId));
}
/**
* 查询预售明细列表
*
* @param landListedId 已挂牌地块id
* @param transactionStatus 交易状态
* @param landListedId 已挂牌地块id
* @return R
*/
@ApiOperation(value = "查询预售明细列表", notes = "查询预售明细列表")
@GetMapping("getPreSaleDetailList")
public R<List<BlocksPreSaleTotalDto>> getPreSaleDetailList(@RequestParam String landListedId, String transactionStatus) {
List<BlocksPreSaleTotalDto> list = new ArrayList<>();
for (int i = 1; i<6;i++){
BlocksPreSaleTotalDto preSaleTotalDto = new BlocksPreSaleTotalDto();
preSaleTotalDto.setPreSaleTotal(200);
preSaleTotalDto.setDestroyTotal(58);
preSaleTotalDto.setDestroyTotalRate(25.6d);
preSaleTotalDto.setPreSaleLicenseNo("2021070"+i+"号");
preSaleTotalDto.setEvidenceDate(DateUtil.formatDate(new Date()));
list.add(preSaleTotalDto);
}
return R.ok(list);
public R<List<BlocksPreSaleTotalDto>> getPreSaleDetailList(@RequestParam String landListedId) {
return R.ok(blocksService.getPreSaleDetailList(landListedId));
}
}

6
air/src/main/java/com/air/applets/dto/BlocksPreSaleTotalDto.java

@ -15,13 +15,13 @@ import lombok.Data;
public class BlocksPreSaleTotalDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "合计预售")
@ApiModelProperty(value = "合计预售(统计地块上楼盘中所有的房屋)")
private int preSaleTotal;
@ApiModelProperty(value = "去化")
@ApiModelProperty(value = "去化(统计地块上楼盘中已销售的房屋)")
private int destroyTotal;
@ApiModelProperty(value = "去化率")
@ApiModelProperty(value = "去化率(合计去化/合计销售)")
private double destroyTotalRate;
@ApiModelProperty(value = "预售住宅均价")

8
air/src/main/java/com/air/applets/mapper/AppletsMapMapper.java

@ -63,17 +63,21 @@ public interface AppletsMapMapper{
/**
* 获取挂牌中数据
* @author peihao
* @param nowDate 系统时间
* @date 2021/6/7
* @return
**/
List<LandToListLonLat> getLandListing();
List<LandListedLonLat> getLandListing(String nowDate);
/**
* 获取出让地块数据
* @author peihao
* @param star 开始时间
* @param end 结束时间
* @param nowDate 系统时间
* @date 2021/6/7
* @return
**/
List<LandListedLonLat> getLandList();
List<LandListedLonLat> getLandList(@Param("star") String star , @Param("end") String end,@Param("nowDate") String nowDate);
}

7
air/src/main/java/com/air/applets/serivce/AppletsMapService.java

@ -3,6 +3,7 @@ package com.air.applets.serivce;
import com.air.applets.entity.*;
import com.air.land.entity.LandListedLonLat;
import com.air.land.entity.LandToListLonLat;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -65,15 +66,17 @@ public interface AppletsMapService{
* @date 2021/6/7
* @return
**/
List<LandToListLonLat> getLandListing();
List<LandListedLonLat> getLandListing();
/**
* 获取出让地块数据
* @author peihao
* @param star 开始时间
* @param end 结束时间
* @date 2021/6/7
* @return
**/
List<LandListedLonLat> getLandList();
List<LandListedLonLat> getLandList(String star , String end);
}

11
air/src/main/java/com/air/applets/serivce/impl/AppletsMapServiceImpl.java

@ -1,5 +1,6 @@
package com.air.applets.serivce.impl;
import cn.hutool.core.date.DateUtil;
import com.air.applets.entity.Dazutuan;
import com.air.applets.entity.Facilities;
import com.air.applets.entity.Huanxian;
@ -11,6 +12,8 @@ import com.air.land.entity.LandToListLonLat;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
@Service
@ -45,12 +48,12 @@ public class AppletsMapServiceImpl implements AppletsMapService {
}
@Override
public List<LandToListLonLat> getLandListing() {
return mapMapper.getLandListing();
public List<LandListedLonLat> getLandListing() {
return mapMapper.getLandListing(DateUtil.formatDate(new Date()));
}
@Override
public List<LandListedLonLat> getLandList() {
return mapMapper.getLandList();
public List<LandListedLonLat> getLandList(String star , String end) {
return mapMapper.getLandList(star,end,DateUtil.formatDate(new Date()));
}
}

12
air/src/main/java/com/air/housing/mapper/BlocksMapper.java

@ -1,15 +1,19 @@
package com.air.housing.mapper;
import com.air.applets.dto.BlocksPreSaleTotalDto;
import com.air.housing.dto.BlockListDto;
import com.air.housing.entity.Blocks;
import com.air.housing.vo.HousingEstatesName;
import com.air.sysMessage.entity.SysMessage;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
import java.math.BigDecimal;
import java.util.List;
/**
@ -27,4 +31,12 @@ public interface BlocksMapper extends BaseMapper<Blocks> {
* @return
*/
Page<Blocks> getBlocksPageByhousingEstateId(Page page, @Param("Blocks")BlockListDto blockListDto);
@SqlParser(filter = true)
BlocksPreSaleTotalDto getSaleInfo(@Param("landListedId") String landListedId);
BigDecimal getHouseAvgPrice(@Param("propertyType") Integer propertyType);
@SqlParser(filter = true)
List<BlocksPreSaleTotalDto> getHouseSaleInfo(Long housingEstatesId);
}

10
air/src/main/java/com/air/housing/service/BlocksService.java

@ -1,10 +1,13 @@
package com.air.housing.service;
import com.air.applets.dto.BlocksPreSaleTotalDto;
import com.air.housing.dto.BlockListDto;
import com.air.housing.entity.Blocks;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 楼栋信息
*
@ -14,10 +17,15 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface BlocksService extends IService<Blocks> {
/**
* query by housing_estate_id and largeFormat,format
*
* @param page
* @param blockListDto
* @return
*/
Page<Blocks> getBlocksPageByhousingEstateId(Page page,BlockListDto blockListDto);
Page<Blocks> getBlocksPageByhousingEstateId(Page page, BlockListDto blockListDto);
BlocksPreSaleTotalDto getPreSaleTotal(String landListId);
List<BlocksPreSaleTotalDto> getPreSaleDetailList(String landListedId);
}

59
air/src/main/java/com/air/housing/service/impl/BlocksServiceImpl.java

@ -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;
}
}

6
air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java

@ -1,13 +1,11 @@
package com.air.housing.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.air.common.Constant;
import com.air.enums.BlocksOriginStatusEnum;
import com.air.housing.dto.HousingDefine;
import com.air.housing.dto.HousingEstatesListDto;
import com.air.housing.dto.HousingEstatesQuery;
import com.air.housing.entity.*;
import com.air.housing.mapper.AnnoBlocksRelMapper;
import com.air.housing.mapper.HousingEstatesMapper;
import com.air.housing.service.*;
import com.air.housing.vo.HousingEstatesDetail;
@ -86,7 +84,7 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
//保存楼盘和地块之间的关系
List<String> landListedIds = housingDefine.getLandListedId();
List<AnnoBlocksRel> annoBlocksRelList = new ArrayList<>(landListedIds.size());
for (int i= 0;i<landListedIds.size();i++){
for (int i = 0; i < landListedIds.size(); i++) {
AnnoBlocksRel annoBlocksRel = new AnnoBlocksRel();
annoBlocksRel.setHousingEstatesId(housingDefine.getHousingEstateId());
annoBlocksRel.setLandListedId(landListedIds.get(i));
@ -173,7 +171,7 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
houses.setHouseUsage(housesOrigin.getHouseUsage());
houses.setNetSignDate(housesOrigin.getNetSignDate());
houses.setNetSignStatus(housesOrigin.getNetSignStatus());
houses.setSaleDate(housesOrigin.getSaleDate());
houses.setSaleStatus(housesOrigin.getSaleStatus());
houses.setSaleDate(housesOrigin.getSaleDate());
houses.setSleeveArea(housesOrigin.getSleeveArea());
houses.setSleevePrice(housesOrigin.getSleevePrice());

4
air/src/main/java/com/air/land/entity/LandListedLonLat.java

@ -93,7 +93,7 @@ public class LandListedLonLat extends Model<LandListedLonLat> {
private String geoms;
@TableField(exist = false)
@ApiModelProperty(value = "拍卖日期")
private LocalDate auctionDate;
@ApiModelProperty(value = "交易状态")
private String transactionStatus;
}

5
air/src/main/java/com/air/land/entity/LandToListLonLat.java

@ -87,9 +87,4 @@ public class LandToListLonLat extends Model<LandToListLonLat> {
@TableField(exist = false)
@ApiModelProperty(value = "空间中标s")
private String geoms;
@TableField(exist = false)
@ApiModelProperty(value = "拍卖日期")
private LocalDate auctionDate;
}

14
air/src/main/resources/mapper/AppletsMapMapper.xml

@ -17,12 +17,12 @@
facilities
WHERE
ST_Distance_Sphere (
st_geomfromtext ( concat('POINT(',#{lat} #{lon},')'), 4326 ),
st_geomfromtext ( concat('POINT(',#{lat},' ',#{lon},')'), 4326 ),
ST_SRID ( geom, 4326 )) &lt; #{ radius}
</select>
<select id="getTypeRegionByLocation" resultType="com.air.applets.entity.Dazutuan">
select *,st_astext(geom) as geoms from #{type}
select *,st_astext(geom) as geoms from ${type}
</select>
<select id="getLoopLine" resultType="com.air.applets.entity.Huanxian">
@ -38,9 +38,9 @@
geom is not null
</select>
<select id="getLandListing" resultType="com.air.land.entity.LandToListLonLat">
<select id="getLandListing" resultType="com.air.land.entity.LandListedLonLat">
SELECT
b.auction_date auctionDate,
if(date_format(b.auction_date,'%Y-%m-%d') &lt; #{nowDate},'已出让','挂牌中') transactionStatus,
a.*,
st_astext (
st_centroid ( a.geom )) AS centerPoint,
@ -54,16 +54,18 @@
<select id="getLandList" resultType="com.air.land.entity.LandListedLonLat">
SELECT
b.auction_date auctionDate,
if(date_format(b.auction_date,'%Y-%m-%d') &lt; #{nowDate},'已出让','挂牌中') transactionStatus,
st_astext (
st_centroid ( a.geom )) AS centerPoint,
a.*,
st_astext ( a.geom ) AS geoms
FROM
land_listed_lon_lat a
LEFT JOIN land_listed b ON a.land_listed_id = b.land_listed_id
JOIN land_listed b ON a.land_listed_id = b.land_listed_id
WHERE
geom IS NOT NULL
and date_format(b.auction_date,'%Y-%m-%d') &lt; #{end}
and date_format(b.auction_date,'%Y-%m-%d') > #{star}
</select>
</mapper>

39
air/src/main/resources/mapper/BlocksMapper.xml

@ -32,4 +32,43 @@
and b.housing_estate_id = #{Blocks.housingEstateId}
</select>
<select id="getSaleInfo" resultType="com.air.applets.dto.BlocksPreSaleTotalDto">
SELECT
count( h.house_id ) preSaleTotal,
count(h.sale_status = '已售') destroyTotal
FROM
anno_blocks_rel ab
JOIN blocks b ON ab.housing_estates_id = b.housing_estate_id
JOIN houses h ON h.block_id = b.block_id
WHERE
ab.land_listed_id = #{landListedId} and ab.main_land = 1
</select>
<select id="getHouseAvgPrice" resultType="java.math.BigDecimal">
SELECT
if(count(h.house_id)>0,sum(h.covered_price)/count(h.house_id),0)
FROM
anno_blocks_rel ab
JOIN blocks b ON ab.housing_estates_id = b.housing_estate_id
JOIN houses h ON h.block_id = b.block_id
WHERE
ab.main_land = 1 and b.property_type = #{propertyType}
</select>
<select id="getHouseSaleInfo" resultType="com.air.applets.dto.BlocksPreSaleTotalDto">
SELECT
b.block_id,
b.housing_estate_id,
b.pre_sale_permit_no preSaleLicenseNo,
date_format(b.create_date,'%Y/%m/%d') evidenceDate,
count( h.house_id ) preSaleTotal,
count(h.sale_status = '已售') destroyTotal
FROM
blocks b
JOIN houses h ON h.block_id = b.block_id
where b.housing_estate_id = #{housingEstatesId}
GROUP BY b.block_id
</select>
</mapper>

Loading…
Cancel
Save