Commit bfcf134b authored by lixinglin's avatar lixinglin

土地信息

parent f443529e
package com.lyy.admin.VO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class LandInfoVO {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 持有方类别
*/
@ApiModelProperty(value = "持有方类别")
private String type;
/**
* 地块名称
*/
@ApiModelProperty(value = "地块名称")
private String name;
/**
* 位置信息(四至信息)
*/
@ApiModelProperty(value = "位置信息(四至信息)")
private String address;
/**
* 面积(亩)
*/
@ApiModelProperty(value = "面积(亩)")
private BigDecimal area;
/**
* 土地现状
*/
@ApiModelProperty(value = "土地现状")
private String landStatus;
/**
* 所属片区
*/
@ApiModelProperty(value = "所属片区")
private Integer developmentId;
@ApiModelProperty(value = "产业方向")
private String industryDirection;
@ApiModelProperty(value = "联系人")
private String contacterName;
@ApiModelProperty(value = "联系电话")
private String contacterPhone;
@ApiModelProperty(value = "价格")
private Double price;
@ApiModelProperty(value = "状态 0-未认证 1-已认证")
private Integer status;
@ApiModelProperty(value = "状态 0-未收藏 1-已收藏")
private Integer isCollection;
}
package com.lyy.admin.controller.developmentinfo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import com.lyy.admin.VO.LandInfoVO;
import com.lyy.admin.common.page.TableDataInfo;
import com.lyy.admin.controller.BaseController;
import com.lyy.admin.domain.SysCollection;
import com.lyy.admin.domain.developmentinfo.DevelopmentIndustrialLandInfo;
import com.lyy.admin.domain.developmentinfo.DevelopmentInfo;
import com.lyy.admin.domain.developmentinfo.LandInfoParam;
import com.lyy.admin.enumerate.SysCollectionTypeEnum;
import com.lyy.admin.enumerate.YesOrNoEnum;
import com.lyy.admin.mapper.SysCollectionMapper;
import com.lyy.admin.service.developmentinfo.DevelopmentIndustrialLandInfoService;
import com.lyy.admin.service.developmentinfo.DevelopmentInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/landInfo")
@Api(tags = "土地信息")
public class LandInfoController extends BaseController {
@Autowired
DevelopmentInfoService developmentInfoSerivce;
@Autowired
SysCollectionMapper sysCollectionMapper;
@Resource
DevelopmentIndustrialLandInfoService developmentIndustrialLandInfoService;
@PostMapping("/list")
@ResponseBody
@ApiOperation(value = "土地列表信息", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "第几页(可为空,后台默认值:1)", type = "String"),
@ApiImplicitParam(name = "pageSize", value = "每页展示数据量(可为空,后台默认值:10)", type = "String"),
@ApiImplicitParam(name = "orderByColumn", value = "排序字段(可为空,传类属性)", type = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序字段(可为空,请传asc或者desc)", type = "String")
})
public TableDataInfo list(LandInfoParam landInfoParam) {
return getTableDataInfo(landInfoParam);
}
private TableDataInfo getTableDataInfo(LandInfoParam landInfoParam) {
boolean login = isLogin();
startPage();
List<DevelopmentIndustrialLandInfo> landInfos = developmentIndustrialLandInfoService.listByParam(landInfoParam);
List<Integer> developIdList = landInfos.stream().map(land -> {
return land.getDevelopmentId();
}).collect(Collectors.toList());
List<DevelopmentInfo> developmentInfos1 = developmentInfoSerivce.listByIds(developIdList);
Map<Integer, Integer> developmentIdAndStatus = developmentInfos1.stream().collect(Collectors.toMap(DevelopmentInfo::getId, developmentInfo -> developmentInfo.getStatus()));
List<LandInfoVO> landInfoVOS = new ArrayList<>();
for (DevelopmentIndustrialLandInfo landInfo : landInfos) {
LandInfoVO landInfoVO = new LandInfoVO();
BeanUtils.copyProperties(landInfo, landInfoVO);
Integer developmentId = landInfo.getDevelopmentId();
landInfoVO.setStatus(developmentIdAndStatus.get(developmentId));
if (login) {
boolean existInfo = sysCollectionMapper.exists(new LambdaQueryWrapper<SysCollection>().eq(SysCollection::getType, SysCollectionTypeEnum.TUDI.getCode()).eq(SysCollection::getUserId, getUserInfo().getUserId()).eq(SysCollection::getCollectId, landInfo.getId()));
if (existInfo) {
landInfoVO.setIsCollection(YesOrNoEnum.YES.getCode());
} else {
landInfoVO.setIsCollection(YesOrNoEnum.NO.getCode());
}
}
landInfoVOS.add(landInfoVO);
}
return getDataTable(landInfoVOS, new PageInfo(landInfos).getTotal());
}
@GetMapping("/get/{id}")
@ResponseBody
@ApiOperation(value = "某个土地信息", notes = "rest风格传参,将参数拼接在url上")
@ApiImplicitParam(name = "id", value = "土地id", type = "Integer")
public LandInfoVO get(@PathVariable Integer id) {
DevelopmentIndustrialLandInfo landInfo = developmentIndustrialLandInfoService.getById(id);
Integer developmentId = landInfo.getDevelopmentId();
Integer landId = landInfo.getId();
DevelopmentInfo developmentInfo = developmentInfoSerivce.getById(developmentId);
boolean existInfo = sysCollectionMapper.exists(new LambdaQueryWrapper<SysCollection>().eq(SysCollection::getType, SysCollectionTypeEnum.TUDI.getCode()).eq(SysCollection::getUserId, getUserInfo().getUserId()).eq(SysCollection::getCollectId, landId));
LandInfoVO landInfoVO = new LandInfoVO();
BeanUtils.copyProperties(landInfo, landInfoVO);
if (existInfo) {
landInfoVO.setIsCollection(YesOrNoEnum.YES.getCode());
} else {
landInfoVO.setIsCollection(YesOrNoEnum.NO.getCode());
}
landInfoVO.setStatus(developmentInfo.getStatus());
return landInfoVO;
}
}
package com.lyy.admin.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName sys_collection
......@@ -34,9 +33,9 @@ public class SysCollection implements Serializable {
private Integer collectId;
/**
* 类型(0 -都市圈、1-开发区、2-园区)
* 类型(0 -都市圈、1-开发区、2-园区 3-土地
*/
@ApiModelProperty(value = " 类型(0 -都市圈、1-开发区、2-园区)")
@ApiModelProperty(value = " 类型(0 -都市圈、1-开发区、2-园区 3-土地)")
private Integer type;
/**
......
......@@ -4,18 +4,17 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
* @TableName development_industrial_land_info
*/
@TableName(value ="development_industrial_land_info")
@TableName(value = "development_industrial_land_info")
@Data
@ApiModel(value = "土地信息")
public class DevelopmentIndustrialLandInfo implements Serializable {
......@@ -61,6 +60,19 @@ public class DevelopmentIndustrialLandInfo implements Serializable {
@ApiModelProperty(value = "所属片区")
private Integer developmentId;
@ApiModelProperty(value = "产业方向")
private String industryDirection;
@ApiModelProperty(value = "联系人")
private String contacterName;
@ApiModelProperty(value = "联系电话")
private String contacterPhone;
@ApiModelProperty(value = "价格")
private Double price;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.lyy.admin.domain.developmentinfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class LandInfoParam implements Serializable {
@ApiModelProperty(value = "主键id传参,支持多个,用英文逗号分割")
private String id;
/**
* 持有方类别
*/
@ApiModelProperty(value = "持有方类别")
private String type;
/**
* 区域面积(规划面积)上限(单位:㎡)
*/
@ApiModelProperty(value = "面积上限")
private Double areaMax;
/**
* 区域面积(规划面积)下限(单位:㎡)
*/
@ApiModelProperty(value = "面积下限")
private Double areaMin;
/**
* 区域面积(规划面积)上限(单位:㎡)
*/
@ApiModelProperty(value = "价格上限")
private Double priceMax;
/**
* 区域面积(规划面积)下限(单位:㎡)
*/
@ApiModelProperty(value = "价格下限")
private Double priceMin;
@ApiModelProperty(hidden = true)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.lyy.admin.enumerate;
public enum SysCollectionTypeEnum {
DUSHIQUAN(0,"都市圈"),
KAIFAQU(1,"开发区"),
YUANUQU(2,"开发区"),
TUDI(3,"土地"),;
private Integer code;
private String name;
SysCollectionTypeEnum(Integer typeId, String name) {
this.code = typeId;
this.name = name;
}
public Integer getCode() {
return code;
}
}
package com.lyy.admin.enumerate;
public enum YesOrNoEnum {
NO(0,"否"),
YES(1,"是");
private Integer code;
private String name;
YesOrNoEnum(Integer typeId, String name) {
this.code = typeId;
this.name = name;
}
public Integer getCode() {
return code;
}
}
package com.lyy.admin.service.developmentinfo;
import com.lyy.admin.domain.developmentinfo.DevelopmentIndustrialLandInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lyy.admin.domain.developmentinfo.DevelopmentIndustrialLandInfo;
import com.lyy.admin.domain.developmentinfo.LandInfoParam;
import java.util.List;
/**
* @author 26996
* @description 针对表【development_industrial_land_info】的数据库操作Service
* @createDate 2023-09-19 17:24:27
*/
* @author 26996
* @description 针对表【development_industrial_land_info】的数据库操作Service
* @createDate 2023-09-19 17:24:27
*/
public interface DevelopmentIndustrialLandInfoService extends IService<DevelopmentIndustrialLandInfo> {
List<DevelopmentIndustrialLandInfo> listByParam(LandInfoParam landInfoParam);
}
package com.lyy.admin.service.developmentinfo.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyy.admin.domain.developmentinfo.DevelopmentIndustrialLandInfo;
import com.lyy.admin.service.developmentinfo.DevelopmentIndustrialLandInfoService;
import com.lyy.admin.domain.developmentinfo.LandInfoParam;
import com.lyy.admin.mapper.developmentinfo.DevelopmentIndustrialLandInfoMapper;
import com.lyy.admin.service.developmentinfo.DevelopmentIndustrialLandInfoService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 26996
* @description 针对表【development_industrial_land_info】的数据库操作Service实现
* @createDate 2023-09-19 17:24:27
*/
* @author 26996
* @description 针对表【development_industrial_land_info】的数据库操作Service实现
* @createDate 2023-09-19 17:24:27
*/
@Service
public class DevelopmentIndustrialLandInfoServiceImpl extends ServiceImpl<DevelopmentIndustrialLandInfoMapper, DevelopmentIndustrialLandInfo>
implements DevelopmentIndustrialLandInfoService{
implements DevelopmentIndustrialLandInfoService {
@Resource
private DevelopmentIndustrialLandInfoMapper developmentIndustrialLandInfoMapper;
@Override
public List<DevelopmentIndustrialLandInfo> listByParam(LandInfoParam landInfoParam) {
String type = landInfoParam.getType();
Double areaMax = landInfoParam.getAreaMax();
Double areaMin = landInfoParam.getAreaMin();
Double priceMin = landInfoParam.getPriceMin();
Double priceMax = landInfoParam.getPriceMax();
LambdaQueryWrapper<DevelopmentIndustrialLandInfo> developmentIndustrialLandInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
developmentIndustrialLandInfoLambdaQueryWrapper.eq(!ObjectUtils.isEmpty(type), DevelopmentIndustrialLandInfo::getType, type);
developmentIndustrialLandInfoLambdaQueryWrapper.between(!ObjectUtils.isEmpty(areaMin) && !ObjectUtils.isEmpty(areaMax), DevelopmentIndustrialLandInfo::getArea, areaMin, areaMax);
developmentIndustrialLandInfoLambdaQueryWrapper.between(!ObjectUtils.isEmpty(priceMin) && !ObjectUtils.isEmpty(priceMax), DevelopmentIndustrialLandInfo::getPrice, priceMin, priceMax);
List<DevelopmentIndustrialLandInfo> landInfos = developmentIndustrialLandInfoMapper.selectList(developmentIndustrialLandInfoLambdaQueryWrapper);
return landInfos;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment