Browse Source

添加周边功能

feature/v.2.0.0
caoyizhong 3 years ago
parent
commit
ecbd6f6318
  1. 2
      air/src/main/java/com/air/applets/controller/AuctionRecordController.java
  2. 1
      air/src/main/java/com/air/applets/convert/LandLonLatConvert.java
  3. 2
      air/src/main/java/com/air/applets/entity/CityAreaLonLatBase.java
  4. 6
      air/src/main/java/com/air/applets/entity/Facilities.java
  5. 2
      air/src/main/java/com/air/applets/mapper/AppletsMapMapper.java
  6. 3
      air/src/main/java/com/air/common/controller/SysFileUploadController.java
  7. 30
      air/src/main/java/com/air/entity/LandTransaction.java
  8. 79
      air/src/main/java/com/air/facilities/controller/FacilitiesController.java
  9. 43
      air/src/main/java/com/air/facilities/dto/FacilitiesDTO.java
  10. 49
      air/src/main/java/com/air/facilities/entity/Facilities.java
  11. 47
      air/src/main/java/com/air/facilities/mapper/FacilitiesMapper.java
  12. 56
      air/src/main/java/com/air/facilities/service/FacilitiesService.java
  13. 130
      air/src/main/java/com/air/facilities/service/impl/FacilitiesServiceImpl.java
  14. 2
      air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java
  15. 65
      air/src/main/resources/mapper/FacilitiesMapper.xml

2
air/src/main/java/com/air/applets/controller/AuctionRecordController.java

@ -45,7 +45,7 @@ public class AuctionRecordController {
LambdaQueryWrapper<AuctionRecord> query = Wrappers.<AuctionRecord>query().lambda()
.eq(StrUtil.isNotEmpty(landListedId), AuctionRecord::getLandListedId, landListedId)
.orderByAsc(AuctionRecord::getSort);
IPage<AuctionRecord> recordPage = auctionRecordService.page(page.toPage(), query);
IPage<AuctionRecord> recordPage = auctionRecordService.page(page.toPage(), query);
return R.ok(recordPage, "查询成功");
}
}

1
air/src/main/java/com/air/applets/convert/LandLonLatConvert.java

@ -34,6 +34,7 @@ public class LandLonLatConvert {
, e.getLineOpaqueness(), e.getLineWidth(), e.getFillColor(), e.getFillOpaqueness());
polygonGeom.setId(id);
landLonLatDto.setPolygon(polygonGeom);
landLonLatDto.setCenterPoint(coordinatePoint.getCenPoint());//中间点
landLonLatDtos.add(landLonLatDto);
});
return landLonLatDtos;

2
air/src/main/java/com/air/applets/entity/CityAreaLonLatBase.java

@ -21,7 +21,7 @@ public class CityAreaLonLatBase {
private String pos;
@ApiModelProperty(value="")
private Integer lineWidth;
@ApiModelProperty(value="")
@ApiModelProperty(value="线颜色")
private String lineColor;
@ApiModelProperty(value="")
private Integer lineOpaqueness;

6
air/src/main/java/com/air/applets/entity/Facilities.java

@ -20,7 +20,7 @@ import java.time.LocalDateTime;
@Data
@TableName("facilities")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "")
@ApiModel(value = "周边设施")
public class Facilities extends Model<Facilities> {
private static final long serialVersionUID = 1L;
@ -34,8 +34,8 @@ public class Facilities extends Model<Facilities> {
private String name;
@ApiModelProperty(value="")
private String typecn;
@ApiModelProperty(value="")
private String desc;
@ApiModelProperty(value="备注")
private String remark;
@ApiModelProperty(value="")
private BigDecimal lon;
@ApiModelProperty(value="")

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

@ -6,6 +6,7 @@ import com.air.cityarea.entity.Huanxian;
import com.air.cityarea.entity.Xiaozutuan;
import com.air.cityarea.entity.Xingzhengqu;
import com.air.land.entity.LandListedLonLat;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -37,6 +38,7 @@ public interface AppletsMapMapper{
* @date 2021/6/7
* @return
**/
@MapKey("gid")
List<Map<String, String>> getFacilitiesByLocation(@Param("lat") String lat, @Param("lon") String lon, @Param("radius") Double radius);
/**

3
air/src/main/java/com/air/common/controller/SysFileUploadController.java

@ -34,7 +34,8 @@ public class SysFileUploadController {
@PostMapping
@SneakyThrows
@ApiOperation("上传文件")
public R<SysFileUploadVo> upload(@ApiParam(value = "文件", required = true) @RequestParam("file") MultipartFile file) {
// @ApiParam(value = "文件", required = true)
public R<SysFileUploadVo> upload(@RequestParam("file") MultipartFile file) {
//判断上传文件大小不超过10m
if (file.getSize() > 1024 * 1024 * 100) {
return R.failed("文件大小不能超过100m");

30
air/src/main/java/com/air/entity/LandTransaction.java

@ -32,7 +32,7 @@ public class LandTransaction extends Model<LandTransaction> {
@ApiModelProperty(value = "")
private String landNum;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "位置")
private String landPosition;
@ApiModelProperty(value = "")
@ -41,48 +41,48 @@ public class LandTransaction extends Model<LandTransaction> {
@ApiModelProperty(value = "")
private String landAreaMi;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "面积")
private String landAreaMe;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "建筑面积")
private String buildArea;
@ApiModelProperty(value = "")
private String volumeRate;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "土地面积")
private String builDensity;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "绿地率")
private String greenRate;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "楼高")
private String limitHigh;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "销售时间")
private String salePeriod;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "出售价")
private String saleStartPrice;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "起始价")
private String startPrice;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "利润")
private String margin;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "公告日")
private LocalDateTime announcementDate;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "销售日期")
private LocalDateTime saleDate;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "有牌照土地")
private String licensedArea;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "路径")
private String url;
}

79
air/src/main/java/com/air/facilities/controller/FacilitiesController.java

@ -0,0 +1,79 @@
package com.air.facilities.controller;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.entity.Facilities;
import com.air.facilities.service.FacilitiesService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cinderella.framework.common.core.util.R;
import com.cinderella.framework.common.data.mybatis.QueryPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @program: back-end
* @description:
* @author: cyz
* @create: 2022-07-07 15:49
**/
@RestController
@RequestMapping("/facilities")
@Api(tags = "城市周边")
@Slf4j
public class FacilitiesController {
@Autowired
private FacilitiesService facilitiesService;
@ApiOperation(value = "添加")
@PostMapping("/add")
public R<Facilities> addFacilities(@RequestBody FacilitiesDTO facilitiesDTO){
log.info("-----------------------------------"+facilitiesDTO);
facilitiesService.addFacilities(facilitiesDTO);
return R.ok();
}
@ApiOperation(value = "修改")
@PutMapping("/update")
public R<Facilities> updateFacilities(@RequestBody FacilitiesDTO facilitiesDTO){
log.info("===================="+facilitiesDTO);
facilitiesService.updateFacilities(facilitiesDTO);
return R.ok();
}
@ApiOperation(value = "查询全部")
@GetMapping("/list")
public R<Page<Facilities>> selectFacilitiesList(QueryPage queryPage, Facilities facilities){
log.info(""+facilities); Page<Facilities> page = queryPage.toPage();
List<Facilities> facilities1 = facilitiesService.selectAllFacilitiesPage(page, facilities);
return R.ok(page.setRecords(facilities1), "查询成功");
}
@ApiOperation(value = "根据ID查询")
@GetMapping("/list/{id}")
public R<Facilities> selectFacilitiesId(@PathVariable("id") String id){
return R.ok();
}
@ApiOperation(value = "删除")
@DeleteMapping("/delete/{ids}")
public R<Facilities> deleteFacilities(@PathVariable String[] ids){
facilitiesService.deleteFacilities(ids);
return R.ok();
}
@ApiOperation(value = "查询周边类型集合")
@GetMapping("/selectTypeList")
public R<List<Facilities>> selectTypeList(){
List<Facilities> facilities = facilitiesService.selectTypeList();
return R.ok(facilities);
}
}

43
air/src/main/java/com/air/facilities/dto/FacilitiesDTO.java

@ -0,0 +1,43 @@
package com.air.facilities.dto;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @program: back-end
* @description:
* @author: cyz
* @create: 2022-07-08 13:41
**/
@Data
public class FacilitiesDTO {
private Integer gid;
@ApiModelProperty(value="名字")
@NotNull(message = "地区名字不能为空")
private String name;
@ApiModelProperty(value="类型名称")
private String typecn;
@ApiModelProperty(value="备注")
private String remark;
@ApiModelProperty(value="经度")//经度值必须在(-180,180]范围内。正值位于本初子午线以东。
@NotNull(message = "经度不能为空")
private BigDecimal lon;
@ApiModelProperty(value="纬度")//纬度值必须在[-90,90]范围内。正值位于赤道以北。
@NotNull(message = "纬度不能为空")
private BigDecimal lat;
@ApiModelProperty(value="类型标识")
private String type;
@ApiModelProperty(value="坐标点")
private String geom;
@ApiModelProperty(value="计算坐标对象")
private String miniGeom;
@ApiModelProperty(value = "旧类型")
private String oldType;
}

49
air/src/main/java/com/air/facilities/entity/Facilities.java

@ -0,0 +1,49 @@
package com.air.facilities.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* @program: back-end
* @description: 城市周边
* @author: cyz
* @create: 2022-07-07 15:18
**/
@Data
@TableName("facilities")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "周边设施")
public class Facilities extends Model<Facilities> {
private static final long serialVersionUID = 1L;
@TableId
@ApiModelProperty(value="gid")
private Integer gid;
@ApiModelProperty(value="id")
private Double id;
@ApiModelProperty(value="名字")
private String name;
@ApiModelProperty(value="类型名称")
private String typecn;
@ApiModelProperty(value="备注")
private String remark;
@ApiModelProperty(value="经度")//经度值必须在(-180,180]范围内。正值位于本初子午线以东。
private BigDecimal lon;
@ApiModelProperty(value="纬度")//纬度值必须在[-90,90]范围内。正值位于赤道以北。
private BigDecimal lat;
@ApiModelProperty(value="类型标识")
private String type;
@ApiModelProperty(value="坐标点")
private String geom;
@ApiModelProperty(value="计算坐标对象")
private String miniGeom;
}

47
air/src/main/java/com/air/facilities/mapper/FacilitiesMapper.java

@ -0,0 +1,47 @@
package com.air.facilities.mapper;
import com.air.facilities.entity.Facilities;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @program: back-end
* @description:
* @author: cyz
* @create: 2022-07-07 15:41
**/
@Repository //告诉容器你是持久层的 @Repository是spring提供的注释,能够将该类注册成Bean
public interface FacilitiesMapper extends BaseMapper<Facilities> {
/**
* 查询全部周边信息
* @param facilities
* @return
*/
List<Facilities> getAllFacilities(Page page ,@Param("facilities")Facilities facilities);
/**
* 查询周边类型集合
* @return
*/
List<Facilities> selectTypeList();
/**
* 删除数据
* @param ids
* @return
*/
int delFacilities(String[] ids);
int insertFacilities(Facilities facilities);
int updateFacilities(Facilities facilities);
}

56
air/src/main/java/com/air/facilities/service/FacilitiesService.java

@ -0,0 +1,56 @@
package com.air.facilities.service;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.entity.Facilities;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface FacilitiesService extends IService<Facilities> {
/**
* 查询全部周边信息
* @param facilities
* @return
*/
List<Facilities> selectAllFacilitiesPage(Page page, Facilities facilities);
/**
* 根据ID查询具体信息
* @param id
* @return
*/
Facilities getFacilitiesId(String id);
/**
* 修改周边信息
* @param facilities
* @return
*/
int putFacilities(Facilities facilities);
/**
* 删除周边信息
*
* @param ids@return
*/
int deleteFacilities(String[] ids);
/**
* 添加周边信息
* @param facilities
* @return
*/
int addFacilities(FacilitiesDTO facilities);
/**
* 查询周边类型集合
* @return
*/
List<Facilities> selectTypeList();
int updateFacilities(FacilitiesDTO facilitiesDTO);
}

130
air/src/main/java/com/air/facilities/service/impl/FacilitiesServiceImpl.java

@ -0,0 +1,130 @@
package com.air.facilities.service.impl;
import cn.hutool.core.util.StrUtil;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.entity.Facilities;
import com.air.facilities.mapper.FacilitiesMapper;
import com.air.facilities.service.FacilitiesService;
import com.air.land.entity.LandListed;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @program: back-end
* @description:
* @author: cyz
* @create: 2022-07-07 15:44
**/
@Service
public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilities> implements FacilitiesService {
@Autowired
private FacilitiesMapper facilitiesMapper;
/**
* 查询全部数据
* @param facilities
* @return
*/
@Override
public List<Facilities> selectAllFacilitiesPage(Page page, Facilities facilities) {
List<Facilities> allFacilities = facilitiesMapper.getAllFacilities(page, facilities);
return allFacilities;
}
/**
* 根据ID查询具体信息
* @param id
* @return
*/
@Override
public Facilities getFacilitiesId(String id) {
Facilities facilities = facilitiesMapper.selectById(id);
return facilities;
}
/**
* 修改周边信息
* @param facilities
* @return
*/
@Override
public int putFacilities(Facilities facilities) {
return facilitiesMapper.update(facilities,null);
}
/**
* 删除周边信息
*
* @param ids@return
*/
@Override
public int deleteFacilities(String[] ids) {
return facilitiesMapper.delFacilities(ids);
}
/**
* 添加
* @param facilitiesDTO
* @return
*/
@Override
public int addFacilities(FacilitiesDTO facilitiesDTO) {
Facilities facilities = new Facilities();
BeanUtils.copyProperties(facilitiesDTO,facilities);
String srt = "POINT("+facilitiesDTO.getLon()+" "+facilitiesDTO.getLat()+")";
facilities.setGeom(srt);
if(StrUtil.isNotBlank(facilitiesDTO.getOldType())){
List<Facilities> facilities1 = facilitiesMapper.selectList(Wrappers.<Facilities>query().lambda().
eq(StringUtils.isNotEmpty(facilitiesDTO.getOldType()), Facilities::getType, facilitiesDTO.getOldType()));
if(facilities1.size() > 0){
facilities.setType(facilities1.get(0).getType());
facilities.setTypecn(facilities1.get(0).getTypecn());
}
}
return facilitiesMapper.insertFacilities(facilities);
}
/**
* 查询周边类型集合
* @return
*/
@Override
public List<Facilities> selectTypeList() {
return facilitiesMapper.selectTypeList();
}
/**
* 修改
* @param facilitiesDTO
* @return
*/
@Override
public int updateFacilities(FacilitiesDTO facilitiesDTO) {
Facilities facilities = new Facilities();
BeanUtils.copyProperties(facilitiesDTO,facilities);
String srt = "POINT("+facilitiesDTO.getLon()+" "+facilitiesDTO.getLat()+")";
facilities.setGeom(srt);
facilities.setGid(facilitiesDTO.getGid());
if(StrUtil.isNotBlank(facilitiesDTO.getOldType())){
List<Facilities> facilities1 = facilitiesMapper.selectList(Wrappers.<Facilities>query().lambda().
eq(StringUtils.isNotEmpty(facilitiesDTO.getOldType()), Facilities::getType, facilitiesDTO.getOldType()));
if(facilities1.size() > 0){
facilities.setType(facilities1.get(0).getType());
facilities.setTypecn(facilities1.get(0).getTypecn());
}
}
return facilitiesMapper.updateFacilities(facilities);
}
}

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

@ -228,7 +228,7 @@ public class LandListedServiceImpl extends ServiceImpl<LandListedMapper, LandLis
* 定时查询已挂出导出全部数据
*/
@Async
@Scheduled(cron = "0 0/10 * * * ?") // 10分执行一次 “0 0 12 ?” 每天12时执行一次
// @Scheduled(cron = "0 0/10 * * * ?") // 10分执行一次 “0 0 12 ?” 每天12时执行一次
public void selectCollection() throws IOException {
log.info("定时查询已挂出导出全部数据"+System.currentTimeMillis());
List<LandListed> landListeds = list();

65
air/src/main/resources/mapper/FacilitiesMapper.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.air.facilities.mapper.FacilitiesMapper">
<select id="getAllFacilities" resultType="com.air.facilities.entity.Facilities">
select gid,id,name,typecn,remark,lon,lat,type,geom,mini_geom from facilities
<where>
<if test="facilities.name != null and facilities.name != ''"> and name like concat('%', #{facilities.name},'%') </if>
<if test="facilities.typecn != null and facilities.typecn != ''"> and typecn =#{facilities.typecn} </if>
</where>
</select>
<select id="selectTypeList" resultType="com.air.facilities.entity.Facilities">
select DISTINCT typecn,type from facilities
</select>
<delete id="delFacilities" parameterType="String">
delete from facilities where gid in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertFacilities">
insert into facilities
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="typecn != null">typecn,</if>
<if test="remark != null">remark,</if>
created_time,
<if test="lon != null">lon,</if>
<if test="lat != null">lat,</if>
<if test="type != null">type,</if>
<if test="geom != null">geom,</if>
<if test="miniGeom != null">mini_geom,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="typecn != null">#{typecn},</if>
<if test="remark != null">#{remark},</if>
now(),
<if test="lon != null">#{lon},</if>
<if test="lat != null">#{lat},</if>
<if test="type != null">#{type},</if>
<if test="geom != null">ST_GeomFromText(#{geom}),</if>
<if test="miniGeom != null">#{miniGeom},</if>
</trim>
</insert>
<update id="updateFacilities" >
update facilities
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="typecn != null"> typecn =#{typecn},</if>
<if test="remark != null">remark =#{remark},</if>
<if test="lon != null">lon = #{lon},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="type != null">type = #{type},</if>
<if test="geom != null">geom = ST_GeomFromText(#{geom}),</if>
<if test="miniGeom != null">miniGeom = #{miniGeom},</if>
</trim>
where gid = #{gid}
</update>
</mapper>
Loading…
Cancel
Save