Browse Source

[feat]修改获取当前所在部门矢量数据

dev
杨威 6 months ago
parent
commit
b232433138
  1. 31
      dk-modules/system/src/main/java/org/dromara/system/domain/bo/SysDepartBoundaryBo.java
  2. 34
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java

31
dk-modules/system/src/main/java/org/dromara/system/domain/bo/SysDepartBoundaryBo.java

@ -7,27 +7,24 @@ import lombok.Getter;
@Data
public class SysDepartBoundaryBo {
private String departId;
/**
* 区域类别 1是市级 2是区级
* 部门id
*/
private AreaType areaType;
private String landCategoriesJson;
private String deptId;
@AllArgsConstructor
@Getter
public enum AreaType {
Municipal("1","市级"),
DistrictLevel("2","区级");
/**
* 部门名称
*/
private String deptName;
private String code;
/**
* 区域类别 areaType: 0市级 1区级() 2镇级(街道) 3村级
*/
private Integer areaType;
private String desc;
/**
* 区域矢量数据
*/
private String landCategoriesJson;
}
}

34
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java

@ -216,22 +216,32 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
@Override
public List<SysDepartBoundaryBo> listJson(SysDepartBoundary departBoundary) {
if(ObjectUtil.isEmpty(departBoundary.getDeptId())){
throw new ServiceException("部门【id】不存在");
SysDepartBoundaryBo result = new SysDepartBoundaryBo();
//获取当前人所属部门
Long deptId = LoginHelper.getDeptId();
LambdaQueryWrapper<SysDepartBoundary> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDepartBoundary::getDeptId, deptId);
List<SysDepartBoundary> boundaryList = baseMapper.selectList(wrapper);
if (ObjectUtil.isEmpty(boundaryList)) {
return List.of();
}
SysDepartBoundaryBo child = new SysDepartBoundaryBo();
child.setDepartId(String.valueOf(departBoundary.getDeptId()));
child.setAreaType(SysDepartBoundaryBo.AreaType.DistrictLevel);
child.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(departBoundary.getDeptId())));
Integer areaType = boundaryList.getFirst().getAreaType();
String deptName = boundaryList.getFirst().getDeptName();
//获取部门所属区域
String landCategories = this.baseMapper.listJson(String.valueOf(deptId));
SysDeptVo sysDeptVo = deptService.getByParentId(String.valueOf(departBoundary.getDeptId()));
SysDepartBoundaryBo parent = new SysDepartBoundaryBo();
parent.setDepartId(String.valueOf(sysDeptVo.getDeptId()));
parent.setAreaType(SysDepartBoundaryBo.AreaType.Municipal);
parent.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(sysDeptVo.getDeptId())));
result.setDeptId(String.valueOf(deptId));
result.setDeptName(deptName);
result.setAreaType(areaType);
result.setLandCategoriesJson(landCategories);
return List.of(child,parent);
return List.of(result);
}
/**

Loading…
Cancel
Save