Browse Source

[feat]修改获取当前所在部门区域查询,修改预警查询

dev
杨威 6 months ago
parent
commit
10bb20c671
  1. 7
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java
  2. 4
      dk-modules/system/src/main/java/org/dromara/system/controller/system/SysDepartBoundaryController.java
  3. 2
      dk-modules/system/src/main/java/org/dromara/system/mapper/SysDepartBoundaryMapper.java
  4. 2
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDepartBoundaryService.java
  5. 8
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java
  6. 30
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java
  7. 15
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java
  8. 8
      dk-modules/system/src/main/resources/mapper/system/SysDepartBoundaryMapper.xml

7
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

@ -689,7 +689,12 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
} }
if (ObjectUtil.isNotEmpty(bo.getDeptId())){ if (ObjectUtil.isNotEmpty(bo.getDeptId())){
wrapper.eq("t.dept_id", bo.getDeptId()); //根据传过来的部门id查找是否存在下级部门
List<RemoteDeptVo> remoteDeptVos = remoteDeptService.selectListByParentId(bo.getDeptId());
List<Long> deptIdList = StreamUtils.toList(remoteDeptVos, RemoteDeptVo::getDeptId);
deptIdList.add(Long.valueOf(bo.getDeptId()));
wrapper.in("t.dept_id", deptIdList);
} }
if (ObjectUtil.isNotEmpty(bo.getJobName())){ if (ObjectUtil.isNotEmpty(bo.getJobName())){

4
dk-modules/system/src/main/java/org/dromara/system/controller/system/SysDepartBoundaryController.java

@ -38,8 +38,8 @@ public class SysDepartBoundaryController extends BaseController {
*/ */
@Operation(summary ="查询部门的地理位置",description = "查询部门的地理位置") @Operation(summary ="查询部门的地理位置",description = "查询部门的地理位置")
@GetMapping(value = "/listJson") @GetMapping(value = "/listJson")
public R<List<SysDepartBoundaryBo>> listJson(SysDepartBoundary departBoundary) { public R<String> listJson(SysDepartBoundary departBoundary) {
List<SysDepartBoundaryBo> listJson = departBoundaryService.listJson(departBoundary); String listJson = departBoundaryService.listJson(departBoundary);
return R.ok("查询成功!",listJson); return R.ok("查询成功!",listJson);
} }
/** /**

2
dk-modules/system/src/main/java/org/dromara/system/mapper/SysDepartBoundaryMapper.java

@ -24,7 +24,7 @@ public interface SysDepartBoundaryMapper extends BaseMapper<SysDepartBoundary> {
void saveBatchBoundary(@Param("list") List<SysDepartBoundary> boundaryList); void saveBatchBoundary(@Param("list") List<SysDepartBoundary> boundaryList);
String listJson(@Param("deptId") String deptId); String listJson(@Param("list") List<Long> deptIdList);
List<SysDepartBoundary> listDepartBoundaryByLngAndLat(@Param("lng") Double lng,@Param("lat") Double lat); List<SysDepartBoundary> listDepartBoundaryByLngAndLat(@Param("lng") Double lng,@Param("lat") Double lat);
} }

2
dk-modules/system/src/main/java/org/dromara/system/service/ISysDepartBoundaryService.java

@ -28,7 +28,7 @@ public interface ISysDepartBoundaryService extends IService<SysDepartBoundary>{
boolean addDepartBoundary(SysDepartBoundary departBoundary); boolean addDepartBoundary(SysDepartBoundary departBoundary);
List<SysDepartBoundaryBo> listJson(SysDepartBoundary departBoundary); String listJson(SysDepartBoundary departBoundary);
List<SysDepartBoundary> listDepartBoundaryByLngAndLat(Double lng, Double lat); List<SysDepartBoundary> listDepartBoundaryByLngAndLat(Double lng, Double lat);

8
dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java

@ -162,4 +162,12 @@ public interface ISysDeptService {
SysDept addBoundaryDept(SysDeptBo sysDeptBo); SysDept addBoundaryDept(SysDeptBo sysDeptBo);
List<SysDeptVo> listTreeDeptByChild(Long deptId); List<SysDeptVo> listTreeDeptByChild(Long deptId);
/**
* 根据当前部门查询下一级
* @param deptId
* @return
*/
List<SysDeptVo> selectSecondByParentId(Long deptId);
} }

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

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.api.domain.vo.RemoteDeptVo; import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.dromara.system.domain.SysDepartBoundary; import org.dromara.system.domain.SysDepartBoundary;
@ -215,33 +216,20 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
} }
@Override @Override
public List<SysDepartBoundaryBo> listJson(SysDepartBoundary departBoundary) { public String listJson(SysDepartBoundary departBoundary) {
SysDepartBoundaryBo result = new SysDepartBoundaryBo();
//获取当前人所属部门 //获取当前人所属部门
Long deptId = LoginHelper.getDeptId(); 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();
}
Integer areaType = boundaryList.getFirst().getAreaType();
String deptName = boundaryList.getFirst().getDeptName();
//获取部门所属区域 //根据当前所属部门id查询下级部门,获取部门所属区域
String landCategories = this.baseMapper.listJson(String.valueOf(deptId)); // List<SysDeptVo> deptVoList = deptService.selectSecondByParentId(deptId);
//
// List<Long> secondDeptIdList = StreamUtils.toList(deptVoList, SysDeptVo::getDeptId);
// secondDeptIdList.add(deptId);
result.setDeptId(String.valueOf(deptId)); return this.baseMapper.listJson(List.of(deptId));
result.setDeptName(deptName);
result.setAreaType(areaType);
result.setLandCategoriesJson(landCategories);
return List.of(result);
} }
/** /**
@ -259,7 +247,7 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
@Override @Override
public String listUserJson() { public String listUserJson() {
Long deptId = LoginHelper.getDeptId(); Long deptId = LoginHelper.getDeptId();
return this.baseMapper.listJson(String.valueOf(deptId)); return this.baseMapper.listJson(List.of(deptId));
} }
@Override @Override

15
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@ -412,4 +412,19 @@ public class SysDeptServiceImpl implements ISysDeptService {
return baseMapper.listTreeDeptByChild(deptId); //.getTableCloud() return baseMapper.listTreeDeptByChild(deptId); //.getTableCloud()
} }
@Override
public List<SysDeptVo> selectSecondByParentId(Long deptId) {
LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDept::getParentId, deptId);
wrapper.eq(SysDept::getStatus, UserConstants.DEPT_NORMAL);
List<SysDeptVo> deptVoList = this.baseMapper.selectVoList(wrapper);
if (ObjectUtil.isEmpty(deptVoList)) {
return List.of();
}
return deptVoList;
}
} }

8
dk-modules/system/src/main/resources/mapper/system/SysDepartBoundaryMapper.xml

@ -154,7 +154,8 @@
'deptId', l.dept_id, 'deptId', l.dept_id,
'deptName', l.dept_name, 'deptName', l.dept_name,
'name', l.name_path, 'name', l.name_path,
'community_name', l.name_path 'community_name', l.name_path,
'areaType',l.area_type
), ),
'geometry', 'geometry',
ST_AsGeoJSON(l.boundary) ST_AsGeoJSON(l.boundary)
@ -167,7 +168,10 @@
sys_depart_boundary l sys_depart_boundary l
LEFT JOIN sys_dept d ON l.dept_id = d.dept_id LEFT JOIN sys_dept d ON l.dept_id = d.dept_id
WHERE WHERE
d.dept_id = #{deptId} d.dept_id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select> </select>
<select id="listDepartBoundaryByLngAndLat" resultType="org.dromara.system.domain.SysDepartBoundary"> <select id="listDepartBoundaryByLngAndLat" resultType="org.dromara.system.domain.SysDepartBoundary">

Loading…
Cancel
Save