综合管理模块完成
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
15683799673 2025-06-28 22:48:11 +08:00
parent 873cf303c2
commit 6b1e9253af
30 changed files with 193 additions and 145 deletions

View File

@ -1,11 +1,11 @@
package org.dromara.common.translation.core.impl; package org.dromara.common.translation.core.impl;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.DictService; import org.dromara.common.core.service.DictService;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.translation.annotation.TranslationType; import org.dromara.common.translation.annotation.TranslationType;
import org.dromara.common.translation.constant.TransConstant; import org.dromara.common.translation.constant.TransConstant;
import org.dromara.common.translation.core.TranslationInterface; import org.dromara.common.translation.core.TranslationInterface;
import lombok.AllArgsConstructor;
/** /**
* 字典翻译实现 * 字典翻译实现
@ -20,7 +20,7 @@ public class DictTypeTranslationImpl implements TranslationInterface<String> {
@Override @Override
public String translation(Object key, String other) { public String translation(Object key, String other) {
if (key instanceof String && StringUtils.isNotBlank(other)) { if (key != null && StringUtils.isNotBlank(other)) {
return dictService.getDictLabel(other, key.toString()); return dictService.getDictLabel(other, key.toString());
} }
return null; return null;

View File

@ -62,11 +62,11 @@ public class TbCommunityController extends BaseController {
* @return 树结构数据 * @return 树结构数据
*/ */
@GetMapping("/tree/{level}") @GetMapping("/tree/{level}")
public List<TreeNode<Long>> tree(@PathVariable("level") Integer level) { public R<List<TreeNode<Long>>> tree(@PathVariable("level") Integer level) {
LoginUser loginUser = LoginHelper.getLoginUser(); LoginUser loginUser = LoginHelper.getLoginUser();
Assert.notNull(loginUser, "获取账户信息失败!"); Assert.notNull(loginUser, "获取账户信息失败!");
Assert.notEmpty(loginUser.getTenantId(), "获取租户信息失败"); Assert.notEmpty(loginUser.getTenantId(), "获取租户信息失败");
return tbCommunityService.tree(level, loginUser.getTenantId()); return R.ok(tbCommunityService.tree(level, loginUser.getTenantId()));
} }

View File

@ -62,9 +62,4 @@ public class SysCityArea implements Serializable {
*/ */
private String lat; private String lat;
/**
* 数据状态1有效0无效
*/
private Long dataState;
} }

View File

@ -32,28 +32,13 @@ public class TbBuilding extends TenantEntity {
/** /**
* 园区编码 * 园区编码
*/ */
private String communityId; private Long communityId;
/** /**
* 建筑名称 * 建筑名称
*/ */
private String buildingName; private String buildingName;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
*
*/
private String district;
/** /**
* 总层数 * 总层数
*/ */

View File

@ -1,13 +1,13 @@
package org.dromara.property.domain; package org.dromara.property.domain;
import org.dromara.common.tenant.core.TenantEntity; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import org.dromara.common.tenant.core.TenantEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial; import java.io.Serial;
import java.util.Date;
/** /**
* 小区对象 tb_community * 小区对象 tb_community
@ -39,6 +39,10 @@ public class TbCommunity extends TenantEntity {
*/ */
private Integer communityType; private Integer communityType;
private String cityFullCode;
private String cityFullName;
/** /**
* *
*/ */

View File

@ -27,6 +27,16 @@ public class TbFloor extends TenantEntity {
@TableId(value = "id") @TableId(value = "id")
private Long id; private Long id;
/**
* 园区id
*/
private Long communityId;
/**
* 建筑id
*/
private Long buildingId;
/** /**
* 单元编码 * 单元编码
*/ */

View File

@ -1,9 +1,10 @@
package org.dromara.property.domain; package org.dromara.property.domain;
import org.dromara.common.tenant.core.TenantEntity; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial; import java.io.Serial;
@ -21,12 +22,25 @@ public class TbRoom extends TenantEntity {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id") @TableId(value = "id")
private Long id; private Long id;
/**
* 园区id
*/
private Long communityId;
/**
* 建筑id
*/
private Long buildingId;
/**
* 单元编码
*/
private Long unitId;
/** /**
* 所属楼层ID * 所属楼层ID
*/ */
@ -50,7 +64,7 @@ public class TbRoom extends TenantEntity {
/** /**
* 户型(如2室1厅1卫) * 户型(如2室1厅1卫)
*/ */
private Integer layout; private String layout;
/** /**
* 朝向('东','南','西','北','东南','东北','西南','西北') * 朝向('东','南','西','北','东南','东北','西南','西北')

View File

@ -28,7 +28,12 @@ public class TbUnit extends TenantEntity {
private Long id; private Long id;
/** /**
* 建筑名称 * 园区id
*/
private Long communityId;
/**
* 建筑id
*/ */
private Long buildingId; private Long buildingId;

View File

@ -70,11 +70,5 @@ public class SysCityAreaBo extends BaseEntity {
@NotBlank(message = "维度不能为空", groups = { AddGroup.class, EditGroup.class }) @NotBlank(message = "维度不能为空", groups = { AddGroup.class, EditGroup.class })
private String lat; private String lat;
/**
* 数据状态1有效0无效
*/
@NotNull(message = "数据状态1有效0无效不能为空", groups = { AddGroup.class, EditGroup.class })
private Long dataState;
} }

View File

@ -32,8 +32,8 @@ public class TbBuildingBo extends BaseEntity {
/** /**
* 园区编码 * 园区编码
*/ */
@NotBlank(message = "园区编码不能为空", groups = {AddGroup.class, EditGroup.class}) @NotBlank(message = "园区id不能为空", groups = {AddGroup.class, EditGroup.class})
private String communityId; private Long communityId;
/** /**
* 建筑名称 * 建筑名称
@ -41,24 +41,6 @@ public class TbBuildingBo extends BaseEntity {
@NotBlank(message = "建筑名称不能为空", groups = {AddGroup.class, EditGroup.class}) @NotBlank(message = "建筑名称不能为空", groups = {AddGroup.class, EditGroup.class})
private String buildingName; private String buildingName;
/**
*
*/
@NotBlank(message = "省不能为空", groups = {AddGroup.class, EditGroup.class})
private String province;
/**
*
*/
@NotBlank(message = "市不能为空", groups = {AddGroup.class, EditGroup.class})
private String city;
/**
*
*/
@NotBlank(message = "区不能为空", groups = {AddGroup.class, EditGroup.class})
private String district;
/** /**
* 总层数 * 总层数
*/ */

View File

@ -1,15 +1,16 @@
package org.dromara.property.domain.bo; package org.dromara.property.domain.bo;
import org.dromara.property.domain.TbCommunity;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.property.domain.TbCommunity;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/** /**
* 小区业务对象 tb_community * 小区业务对象 tb_community
@ -40,22 +41,24 @@ public class TbCommunityBo extends BaseEntity {
@NotNull(message = "社区类型 1园区2小区不能为空", groups = {AddGroup.class, EditGroup.class}) @NotNull(message = "社区类型 1园区2小区不能为空", groups = {AddGroup.class, EditGroup.class})
private Integer communityType; private Integer communityType;
@NotBlank(message = "城市不能为null", groups = {AddGroup.class, EditGroup.class})
private String cityFullCode;
private String cityFullName;
/** /**
* *
*/ */
@NotBlank(message = "省不能为空", groups = { AddGroup.class, EditGroup.class })
private String province; private String province;
/** /**
* *
*/ */
@NotBlank(message = "市不能为空", groups = { AddGroup.class, EditGroup.class })
private String city; private String city;
/** /**
* *
*/ */
@NotBlank(message = "区不能为空", groups = { AddGroup.class, EditGroup.class })
private String district; private String district;
/** /**

View File

@ -29,7 +29,7 @@ public class TbFloorBo extends BaseEntity {
/** /**
* 单元编码 * 单元编码
*/ */
@NotBlank(message = "单元编码不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "单元编码不能为空", groups = { AddGroup.class, EditGroup.class })
private Long unitId; private Long unitId;
/** /**

View File

@ -29,7 +29,7 @@ public class TbRoomBo extends BaseEntity {
/** /**
* 所属楼层ID * 所属楼层ID
*/ */
@NotBlank(message = "所属楼层ID不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "所属楼层ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long floorId; private Long floorId;
/** /**

View File

@ -29,7 +29,7 @@ public class TbUnitBo extends BaseEntity {
/** /**
* 建筑名称 * 建筑名称
*/ */
@NotBlank(message = "建筑名称不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "建筑名称不能为空", groups = { AddGroup.class, EditGroup.class })
private Long buildingId; private Long buildingId;
/** /**

View File

@ -2,6 +2,7 @@ package org.dromara.property.domain.convert;
import org.dromara.property.domain.SysCityArea; import org.dromara.property.domain.SysCityArea;
import org.dromara.property.domain.vo.CityAreaTreeVo; import org.dromara.property.domain.vo.CityAreaTreeVo;
import org.dromara.property.domain.vo.SysCityAreaVo;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants; import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;
@ -21,4 +22,6 @@ public interface SysCityAreaCovert {
List<CityAreaTreeVo> entity2Vo(List<SysCityArea> cityAreas); List<CityAreaTreeVo> entity2Vo(List<SysCityArea> cityAreas);
List<CityAreaTreeVo> vo2TreeVo(List<SysCityAreaVo> cityAreas);
} }

View File

@ -1,11 +1,14 @@
package org.dromara.property.domain.vo; package org.dromara.property.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.common.core.domain.TreeEntity; import org.dromara.common.core.domain.TreeEntity;
import org.dromara.property.domain.SysCityArea;
import java.util.List; import java.util.List;
@Data @Data
@AutoMapper(target = SysCityArea.class)
public class CityAreaTreeVo implements TreeEntity<CityAreaTreeVo, String> { public class CityAreaTreeVo implements TreeEntity<CityAreaTreeVo, String> {
/** /**

View File

@ -77,11 +77,4 @@ public class SysCityAreaVo implements Serializable {
@ExcelProperty(value = "维度") @ExcelProperty(value = "维度")
private String lat; private String lat;
/**
* 数据状态1有效0无效
*/
@ExcelProperty(value = "数据状态1有效0无效")
private Long dataState;
} }

View File

@ -1,21 +1,18 @@
package org.dromara.property.domain.vo; package org.dromara.property.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.property.domain.TbBuilding;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.property.domain.TbBuilding;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 建筑视图对象 tb_building * 建筑视图对象 tb_building
* *
@ -45,24 +42,6 @@ public class TbBuildingVo implements Serializable {
@ExcelProperty(value = "建筑名称") @ExcelProperty(value = "建筑名称")
private String buildingName; private String buildingName;
/**
*
*/
@ExcelProperty(value = "")
private String province;
/**
*
*/
@ExcelProperty(value = "")
private String city;
/**
*
*/
@ExcelProperty(value = "")
private String district;
/** /**
* 总层数 * 总层数
*/ */
@ -81,6 +60,9 @@ public class TbBuildingVo implements Serializable {
@ExcelProperty(value = "建筑类型('1住宅','2商业','3:混合')") @ExcelProperty(value = "建筑类型('1住宅','2商业','3:混合')")
private Integer buildType; private Integer buildType;
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "buildType", other = "sis_build_use_type")
private String buildTypeName;
/** /**
* 电梯数量 * 电梯数量
*/ */
@ -111,12 +93,6 @@ public class TbBuildingVo implements Serializable {
@ExcelProperty(value = "维度") @ExcelProperty(value = "维度")
private String lat; private String lat;
/**
* 产权性质(1:自持2承租3自持+承租,4政府免费使用)
*/
@ExcelProperty(value = "产权性质(1:自持2承租3自持+承租,4政府免费使用)")
private Integer cqxz;
/** /**
* 排序字段 * 排序字段
*/ */

View File

@ -1,21 +1,16 @@
package org.dromara.property.domain.vo; package org.dromara.property.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.property.domain.TbCommunity;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.property.domain.TbCommunity;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 小区视图对象 tb_community * 小区视图对象 tb_community
* *
@ -48,6 +43,10 @@ public class TbCommunityVo implements Serializable {
@ExcelProperty(value = "社区类型 1园区2小区") @ExcelProperty(value = "社区类型 1园区2小区")
private Long communityType; private Long communityType;
private String cityFullCode;
private String cityFullName;
/** /**
* *
*/ */

View File

@ -34,6 +34,17 @@ public class TbFloorVo implements Serializable {
@ExcelProperty(value = "") @ExcelProperty(value = "")
private Long id; private Long id;
/**
* 社区id
*/
private Long communityId;
/**
* 建筑名称
*/
@ExcelProperty(value = "建筑名称")
private Long buildingId;
/** /**
* 单元编码 * 单元编码
*/ */

View File

@ -1,17 +1,17 @@
package org.dromara.property.domain.vo; package org.dromara.property.domain.vo;
import org.dromara.property.domain.TbRoom;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.property.domain.TbRoom;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
@ -34,6 +34,23 @@ public class TbRoomVo implements Serializable {
@ExcelProperty(value = "") @ExcelProperty(value = "")
private Long id; private Long id;
/**
* 社区id
*/
private Long communityId;
/**
* 建筑名称
*/
@ExcelProperty(value = "建筑名称")
private Long buildingId;
/**
* 单元编码
*/
@ExcelProperty(value = "单元编码")
private Long unitId;
/** /**
* 所属楼层ID * 所属楼层ID
*/ */
@ -52,6 +69,9 @@ public class TbRoomVo implements Serializable {
@ExcelProperty(value = "房间类型('住宅','商铺','办公室','设备间','公共区域')") @ExcelProperty(value = "房间类型('住宅','商铺','办公室','设备间','公共区域')")
private Integer roomType; private Integer roomType;
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "roomType", other = "room_type")
private String roomTypeName;
/** /**
* 面积(平方米) * 面积(平方米)
*/ */
@ -67,9 +87,13 @@ public class TbRoomVo implements Serializable {
/** /**
* 朝向('东','南','西','北','东南','东北','西南','西北') * 朝向('东','南','西','北','东南','东北','西南','西北')
*/ */
@ExcelProperty(value = "朝向('东','南','西','北','东南','东北','西南','西北')") @ExcelProperty(value = "朝向('东','南','西','北','东南','东北','西南','西北')")
private Integer orientation; private Integer orientation;
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "orientation", other = "direction_towards")
private Integer orientationName;
/** /**
* 是否可售 * 是否可售
*/ */
@ -83,5 +107,7 @@ public class TbRoomVo implements Serializable {
@ExcelDictFormat(readConverterExp = "'=空置','已售','已租','自用'") @ExcelDictFormat(readConverterExp = "'=空置','已售','已租','自用'")
private Integer status; private Integer status;
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "status", other = "wy_fjzt")
private String statusName;
} }

View File

@ -34,6 +34,8 @@ public class TbUnitVo implements Serializable {
@ExcelProperty(value = "主键id") @ExcelProperty(value = "主键id")
private Long id; private Long id;
private Long communityId;
/** /**
* 建筑名称 * 建筑名称
*/ */

View File

@ -1,16 +1,23 @@
package org.dromara.property.mapper; package org.dromara.property.mapper;
import org.dromara.property.domain.SysCityArea; import org.apache.ibatis.annotations.Select;
import org.dromara.property.domain.vo.SysCityAreaVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.property.domain.SysCityArea;
import org.dromara.property.domain.vo.CityAreaTreeVo;
import org.dromara.property.domain.vo.SysCityAreaVo;
import java.util.List;
/** /**
* 行政区划 * 行政区划
Mapper接口 * Mapper接口
* *
* @author mocheng * @author mocheng
* @date 2025-06-18 * @date 2025-06-18
*/ */
public interface SysCityAreaMapper extends BaseMapperPlus<SysCityArea, SysCityAreaVo> { public interface SysCityAreaMapper extends BaseMapperPlus<SysCityArea, SysCityAreaVo> {
@Select("select * from sys_city_area")
List<CityAreaTreeVo> seleAll();
} }

View File

@ -80,6 +80,6 @@ public interface ITbCommunityService {
* @param level 加载等级 * @param level 加载等级
* @return 树结构 * @return 树结构
*/ */
List<TreeNode<String>> tree(Integer level,String tenantId); List<TreeNode<Long>> tree(Integer level,String tenantId);
} }

View File

@ -91,7 +91,6 @@ public class SysCityAreaServiceImpl implements ISysCityAreaService {
lqw.like(StringUtils.isNotBlank(bo.getParentAreaName()), SysCityArea::getParentAreaName, bo.getParentAreaName()); lqw.like(StringUtils.isNotBlank(bo.getParentAreaName()), SysCityArea::getParentAreaName, bo.getParentAreaName());
lqw.eq(StringUtils.isNotBlank(bo.getLon()), SysCityArea::getLon, bo.getLon()); lqw.eq(StringUtils.isNotBlank(bo.getLon()), SysCityArea::getLon, bo.getLon());
lqw.eq(StringUtils.isNotBlank(bo.getLat()), SysCityArea::getLat, bo.getLat()); lqw.eq(StringUtils.isNotBlank(bo.getLat()), SysCityArea::getLat, bo.getLat());
lqw.eq(bo.getDataState() != null, SysCityArea::getDataState, bo.getDataState());
return lqw; return lqw;
} }
@ -150,12 +149,7 @@ public class SysCityAreaServiceImpl implements ISysCityAreaService {
@Override @Override
public List<CityAreaTreeVo> queryTreeList() { public List<CityAreaTreeVo> queryTreeList() {
// 查询所有的行政区划数据 List<CityAreaTreeVo> vo = baseMapper.seleAll();
List<SysCityArea> cityAreas = baseMapper.selectList(null);
if (CollectionUtil.isEmpty(cityAreas)) {
return new ArrayList<>();
}
List<CityAreaTreeVo> vo = SysCityAreaCovert.INSTANCE.entity2Vo(cityAreas);
return TreeUtils.build(vo, "0"); return TreeUtils.build(vo, "0");
} }
} }

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -12,7 +13,9 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.property.domain.TbBuilding; import org.dromara.property.domain.TbBuilding;
import org.dromara.property.domain.bo.TbBuildingBo; import org.dromara.property.domain.bo.TbBuildingBo;
import org.dromara.property.domain.vo.TbBuildingVo; import org.dromara.property.domain.vo.TbBuildingVo;
import org.dromara.property.domain.vo.TbCommunityVo;
import org.dromara.property.mapper.TbBuildingMapper; import org.dromara.property.mapper.TbBuildingMapper;
import org.dromara.property.mapper.TbCommunityMapper;
import org.dromara.property.service.ITbBuildingService; import org.dromara.property.service.ITbBuildingService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,6 +35,7 @@ import java.util.Map;
public class TbBuildingServiceImpl implements ITbBuildingService { public class TbBuildingServiceImpl implements ITbBuildingService {
private final TbBuildingMapper baseMapper; private final TbBuildingMapper baseMapper;
private final TbCommunityMapper communityMapper;
/** /**
* 查询建筑 * 查询建筑
@ -76,9 +80,6 @@ public class TbBuildingServiceImpl implements ITbBuildingService {
lqw.orderByAsc(TbBuilding::getId); lqw.orderByAsc(TbBuilding::getId);
lqw.eq(bo.getCommunityId() != null, TbBuilding::getCommunityId, bo.getCommunityId()); lqw.eq(bo.getCommunityId() != null, TbBuilding::getCommunityId, bo.getCommunityId());
lqw.like(StringUtils.isNotBlank(bo.getBuildingName()), TbBuilding::getBuildingName, bo.getBuildingName()); lqw.like(StringUtils.isNotBlank(bo.getBuildingName()), TbBuilding::getBuildingName, bo.getBuildingName());
lqw.eq(StringUtils.isNotBlank(bo.getProvince()), TbBuilding::getProvince, bo.getProvince());
lqw.eq(StringUtils.isNotBlank(bo.getCity()), TbBuilding::getCity, bo.getCity());
lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), TbBuilding::getDistrict, bo.getDistrict());
lqw.eq(bo.getFloorCount() != null, TbBuilding::getFloorCount, bo.getFloorCount()); lqw.eq(bo.getFloorCount() != null, TbBuilding::getFloorCount, bo.getFloorCount());
lqw.eq(bo.getUnitCount() != null, TbBuilding::getUnitCount, bo.getUnitCount()); lqw.eq(bo.getUnitCount() != null, TbBuilding::getUnitCount, bo.getUnitCount());
lqw.eq(bo.getBuildType() != null, TbBuilding::getBuildType, bo.getBuildType()); lqw.eq(bo.getBuildType() != null, TbBuilding::getBuildType, bo.getBuildType());
@ -99,6 +100,9 @@ public class TbBuildingServiceImpl implements ITbBuildingService {
*/ */
@Override @Override
public Boolean insertByBo(TbBuildingBo bo) { public Boolean insertByBo(TbBuildingBo bo) {
// 检验社区是否存在
TbCommunityVo tbCommunityVo = communityMapper.selectVoById(bo.getCommunityId());
Assert.notNull(tbCommunityVo, "社区:{},不存在。", bo.getCommunityId());
TbBuilding add = MapstructUtils.convert(bo, TbBuilding.class); TbBuilding add = MapstructUtils.convert(bo, TbBuilding.class);
validEntityBeforeSave(add); validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;

View File

@ -1,5 +1,7 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -196,6 +198,12 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
*/ */
@Override @Override
public Boolean insertByBo(TbCommunityBo bo) { public Boolean insertByBo(TbCommunityBo bo) {
// 处理cityFullCode
String[] split = bo.getCityFullCode().split("/");
Assert.isTrue(split.length == 3, "获取城市信息失败");
bo.setProvince(split[0]);
bo.setCity(split[1]);
bo.setDistrict(split[2]);
TbCommunity add = MapstructUtils.convert(bo, TbCommunity.class); TbCommunity add = MapstructUtils.convert(bo, TbCommunity.class);
validEntityBeforeSave(add); validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
@ -213,6 +221,11 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
*/ */
@Override @Override
public Boolean updateByBo(TbCommunityBo bo) { public Boolean updateByBo(TbCommunityBo bo) {
String[] split = bo.getCityFullCode().split("/");
Assert.isTrue(split.length == 3, "获取城市信息失败");
bo.setProvince(split[0]);
bo.setCity(split[1]);
bo.setDistrict(split[2]);
TbCommunity update = MapstructUtils.convert(bo, TbCommunity.class); TbCommunity update = MapstructUtils.convert(bo, TbCommunity.class);
validEntityBeforeSave(update); validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0; return baseMapper.updateById(update) > 0;

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -12,8 +13,10 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.property.domain.TbFloor; import org.dromara.property.domain.TbFloor;
import org.dromara.property.domain.bo.TbFloorBo; import org.dromara.property.domain.bo.TbFloorBo;
import org.dromara.property.domain.vo.TbFloorVo; import org.dromara.property.domain.vo.TbFloorVo;
import org.dromara.property.domain.vo.TbUnitVo;
import org.dromara.property.mapper.TbFloorMapper; import org.dromara.property.mapper.TbFloorMapper;
import org.dromara.property.service.ITbFloorService; import org.dromara.property.service.ITbFloorService;
import org.dromara.property.service.ITbUnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection; import java.util.Collection;
@ -32,6 +35,7 @@ import java.util.Map;
public class TbFloorServiceImpl implements ITbFloorService { public class TbFloorServiceImpl implements ITbFloorService {
private final TbFloorMapper baseMapper; private final TbFloorMapper baseMapper;
private final ITbUnitService tbUnitService;
/** /**
* 查询楼层 * 查询楼层
@ -91,7 +95,12 @@ public class TbFloorServiceImpl implements ITbFloorService {
*/ */
@Override @Override
public Boolean insertByBo(TbFloorBo bo) { public Boolean insertByBo(TbFloorBo bo) {
// 验证单元是否存在
TbUnitVo tbUnitVo = tbUnitService.queryById(bo.getUnitId());
Assert.notNull(tbUnitVo, "单元:{},不存在。", bo.getUnitId());
TbFloor add = MapstructUtils.convert(bo, TbFloor.class); TbFloor add = MapstructUtils.convert(bo, TbFloor.class);
add.setCommunityId(tbUnitVo.getCommunityId());
add.setBuildingId(tbUnitVo.getBuildingId());
validEntityBeforeSave(add); validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag) {

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -11,8 +12,10 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.property.domain.TbRoom; import org.dromara.property.domain.TbRoom;
import org.dromara.property.domain.bo.TbRoomBo; import org.dromara.property.domain.bo.TbRoomBo;
import org.dromara.property.domain.vo.TbFloorVo;
import org.dromara.property.domain.vo.TbRoomVo; import org.dromara.property.domain.vo.TbRoomVo;
import org.dromara.property.mapper.TbRoomMapper; import org.dromara.property.mapper.TbRoomMapper;
import org.dromara.property.service.ITbFloorService;
import org.dromara.property.service.ITbRoomService; import org.dromara.property.service.ITbRoomService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,6 +35,7 @@ import java.util.Map;
public class TbRoomServiceImpl implements ITbRoomService { public class TbRoomServiceImpl implements ITbRoomService {
private final TbRoomMapper baseMapper; private final TbRoomMapper baseMapper;
private final ITbFloorService tbFloorService;
/** /**
* 查询房间信息 * 查询房间信息
@ -93,8 +97,12 @@ public class TbRoomServiceImpl implements ITbRoomService {
*/ */
@Override @Override
public Boolean insertByBo(TbRoomBo bo) { public Boolean insertByBo(TbRoomBo bo) {
TbFloorVo tbFloorVo = tbFloorService.queryById(bo.getFloorId());
Assert.notNull(tbFloorVo, "楼层:{},不存在。", bo.getFloorId());
TbRoom add = MapstructUtils.convert(bo, TbRoom.class); TbRoom add = MapstructUtils.convert(bo, TbRoom.class);
validEntityBeforeSave(add); add.setCommunityId(tbFloorVo.getCommunityId());
add.setBuildingId(tbFloorVo.getBuildingId());
add.setUnitId(tbFloorVo.getUnitId());
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag) {
bo.setId(add.getId()); bo.setId(add.getId());

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -11,8 +12,10 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.property.domain.TbUnit; import org.dromara.property.domain.TbUnit;
import org.dromara.property.domain.bo.TbUnitBo; import org.dromara.property.domain.bo.TbUnitBo;
import org.dromara.property.domain.vo.TbBuildingVo;
import org.dromara.property.domain.vo.TbUnitVo; import org.dromara.property.domain.vo.TbUnitVo;
import org.dromara.property.mapper.TbUnitMapper; import org.dromara.property.mapper.TbUnitMapper;
import org.dromara.property.service.ITbBuildingService;
import org.dromara.property.service.ITbUnitService; import org.dromara.property.service.ITbUnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,6 +35,7 @@ import java.util.Map;
public class TbUnitServiceImpl implements ITbUnitService { public class TbUnitServiceImpl implements ITbUnitService {
private final TbUnitMapper baseMapper; private final TbUnitMapper baseMapper;
private final ITbBuildingService buildingService;
/** /**
* 查询单元 * 查询单元
@ -90,7 +94,11 @@ public class TbUnitServiceImpl implements ITbUnitService {
*/ */
@Override @Override
public Boolean insertByBo(TbUnitBo bo) { public Boolean insertByBo(TbUnitBo bo) {
// 检验建筑是否存在
TbBuildingVo tbBuildingVo = buildingService.queryById(bo.getBuildingId());
Assert.notNull(tbBuildingVo, "建筑:{},不存在。", bo.getBuildingId());
TbUnit add = MapstructUtils.convert(bo, TbUnit.class); TbUnit add = MapstructUtils.convert(bo, TbUnit.class);
add.setCommunityId(tbBuildingVo.getCommunityId());
validEntityBeforeSave(add); validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag) {