Kaynağa Gözat

'获取组织架构新增是否有子级'

master
牧羊人 4 yıl önce
ebeveyn
işleme
72b9a4c54c
8 değiştirilmiş dosya ile 131 ekleme ve 29 silme
  1. +3
    -3
      src/main/java/com/taauav/admin/controller/LsCityController.java
  2. +5
    -0
      src/main/java/com/taauav/admin/entity/LsAuthGroup.java
  3. +1
    -1
      src/main/java/com/taauav/admin/service/ILsAdminService.java
  4. +12
    -2
      src/main/java/com/taauav/admin/service/ILsCityService.java
  5. +4
    -4
      src/main/java/com/taauav/admin/service/impl/LsAdminServiceImpl.java
  6. +50
    -9
      src/main/java/com/taauav/admin/service/impl/LsCityServiceImpl.java
  7. +17
    -0
      src/main/java/com/taauav/admin/vo/LsCityListVo.java
  8. +39
    -10
      src/main/java/com/taauav/front/service/impl/LSReportServiceImpl.java

+ 3
- 3
src/main/java/com/taauav/admin/controller/LsCityController.java Dosyayı Görüntüle

@@ -2,7 +2,7 @@ package com.taauav.admin.controller;


import com.taauav.admin.entity.SysCity;
import com.taauav.admin.service.ITauvCityService;
import com.taauav.admin.service.ILsCityService;
import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -26,7 +26,7 @@ import java.math.BigInteger;
public class LsCityController {

@Autowired
private ITauvCityService tauvAgencyService;
private ILsCityService tauvAgencyService;

@Autowired
private Response response;
@@ -122,7 +122,7 @@ public class LsCityController {
*/
@GetMapping("/getChildCityList")
public Response getChildCityList(BigInteger pid) {
return tauvAgencyService.getChildCityList(pid);
return response.success(tauvAgencyService.getChildCityList(pid));
}

}

+ 5
- 0
src/main/java/com/taauav/admin/entity/LsAuthGroup.java Dosyayı Görüntüle

@@ -37,6 +37,11 @@ public class LsAuthGroup extends Entity {
@NotBlank(message = "数据权限不能为空")
private Integer authData;

/**
* 区划ID(多个逗号分隔)
*/
private String driverArea;

/**
* 备注
*/

+ 1
- 1
src/main/java/com/taauav/admin/service/ILsAdminService.java Dosyayı Görüntüle

@@ -89,7 +89,7 @@ public interface ILsAdminService extends IBaseService<LsAdmin> {
* @param userId 用户ID
* @return
*/
List<Integer> getAdminAuthData(Integer userId);
Map<Integer, String> getAdminAuthData(Integer userId);

/**
* 获取河长列表

src/main/java/com/taauav/admin/service/ITauvCityService.java → src/main/java/com/taauav/admin/service/ILsCityService.java Dosyayı Görüntüle

@@ -2,9 +2,11 @@ package com.taauav.admin.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.admin.entity.SysCity;
import com.taauav.admin.vo.LsCityListVo;
import com.taauav.common.bean.Response;

import java.math.BigInteger;
import java.util.List;

/**
* <p>
@@ -14,7 +16,7 @@ import java.math.BigInteger;
* @author dyg
* @since 2020-04-01
*/
public interface ITauvCityService extends IService<SysCity> {
public interface ILsCityService extends IService<SysCity> {

/**
* 获取机构列表
@@ -69,6 +71,14 @@ public interface ITauvCityService extends IService<SysCity> {
* @param pid 上级ID
* @return
*/
Response getChildCityList(BigInteger pid);
List<LsCityListVo> getChildCityList(BigInteger pid);

/**
* 获取子级城市ID
*
* @param pid 上级城市
* @return
*/
List<BigInteger> getChildCityIds(BigInteger pid);

}

+ 4
- 4
src/main/java/com/taauav/admin/service/impl/LsAdminServiceImpl.java Dosyayı Görüntüle

@@ -249,7 +249,7 @@ public class LsAdminServiceImpl extends BaseServiceImpl<LsAdminMapper, LsAdmin>
* @return
*/
@Override
public List<Integer> getAdminAuthData(Integer userId) {
public Map<Integer, String> getAdminAuthData(Integer userId) {
LsAdmin adminInfo = lsAdminMapper.selectById(userId);
if (adminInfo == null) {
return null;
@@ -269,17 +269,17 @@ public class LsAdminServiceImpl extends BaseServiceImpl<LsAdminMapper, LsAdmin>
queryWrapper.eq("mark", 1);

// 查询数据
List<Integer> authDataList = new ArrayList<>();
Map<Integer, String> result = new HashMap<>();
List<LsAuthGroup> authGroupList = authGroupMapper.selectList(queryWrapper);
if (!authGroupList.isEmpty()) {
for (LsAuthGroup lsAuthGroup : authGroupList) {
if (lsAuthGroup.getAuthData() == null || lsAuthGroup.getAuthData() <= 0) {
continue;
}
authDataList.add(Integer.valueOf(lsAuthGroup.getAuthData()));
result.put(Integer.valueOf(lsAuthGroup.getAuthData()), lsAuthGroup.getDriverArea());
}
}
return authDataList;
return result;
}

/**

src/main/java/com/taauav/admin/service/impl/TauvCityServiceImpl.java → src/main/java/com/taauav/admin/service/impl/LsCityServiceImpl.java Dosyayı Görüntüle

@@ -1,17 +1,14 @@
package com.taauav.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.admin.entity.SysCity;
import com.taauav.admin.mapper.SysCityMapper;
import com.taauav.admin.service.ITauvCityService;
import com.taauav.admin.vo.TauvCityListVo;
import com.taauav.admin.service.ILsCityService;
import com.taauav.admin.vo.LsCityListVo;
import com.taauav.common.bean.Response;
import com.taauav.common.util.DateUtil;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -29,7 +26,7 @@ import java.util.List;
* @since 2020-04-01
*/
@Service
public class TauvCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> implements ITauvCityService {
public class LsCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> implements ILsCityService {

@Autowired
private SysCityMapper sysCityMapper;
@@ -62,13 +59,57 @@ public class TauvCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> imp
* @return
*/
@Override
public Response getChildCityList(BigInteger pid) {
public List<LsCityListVo> getChildCityList(BigInteger pid) {
QueryWrapper<SysCity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pid", pid);
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");
List<SysCity> agencyList = sysCityMapper.selectList(queryWrapper);
return response.success(agencyList);
List<SysCity> cityList = sysCityMapper.selectList(queryWrapper);
List<LsCityListVo> cityListVoList = new ArrayList<>();
if (!cityList.isEmpty()) {
cityList.forEach(item -> {
LsCityListVo cityListVo = new LsCityListVo();
// 拷贝属性
BeanUtils.copyProperties(item, cityListVo);
// 判断是否有子级
List<LsCityListVo> childrenList = this.getChildCityList(item.getId());
if (!childrenList.isEmpty()) {
cityListVo.setHasChildren(true);
} else {
cityListVo.setHasChildren(false);
}
cityListVoList.add(cityListVo);
});
}
return cityListVoList;
}

/**
* 获取子级城市ID
*
* @param pid 上级城市
* @return
*/
@Override
public List<BigInteger> getChildCityIds(BigInteger pid) {
QueryWrapper<SysCity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pid", pid);
queryWrapper.eq("mark", 1);
List<SysCity> cityList = sysCityMapper.selectList(queryWrapper);
List<BigInteger> cityIdsList = new ArrayList<>();
if (!cityList.isEmpty()) {
cityList.forEach(item -> {
cityIdsList.add(item.getId());
// 获取子级
List<BigInteger> itemList = this.getChildCityIds(item.getId());
if (!itemList.isEmpty()) {
itemList.forEach(subItem -> {
cityIdsList.add(subItem);
});
}
});
}
return cityIdsList;
}

/**

+ 17
- 0
src/main/java/com/taauav/admin/vo/LsCityListVo.java Dosyayı Görüntüle

@@ -0,0 +1,17 @@
package com.taauav.admin.vo;

import com.taauav.admin.entity.SysCity;
import lombok.Data;

/**
* 溧水组织架构列表Vo
*/
@Data
public class LsCityListVo extends SysCity {

/**
* 是否有子级
*/
boolean hasChildren;

}

+ 39
- 10
src/main/java/com/taauav/front/service/impl/LSReportServiceImpl.java Dosyayı Görüntüle

@@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.TauvInspectDriver;
import com.taauav.admin.entity.TauvQuestionOptions;
import com.taauav.admin.entity.TauvReport;
import com.taauav.admin.entity.TauvReportRemark;
import com.taauav.admin.entity.*;
import com.taauav.admin.mapper.LsAdminMapper;
import com.taauav.admin.mapper.TauvInspectDriverMapper;
import com.taauav.admin.service.*;
import com.taauav.common.bean.Response;
@@ -26,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.*;

/**
@@ -69,6 +68,13 @@ public class LSReportServiceImpl extends BaseServiceImpl<LSReportMapper, TauvRep
@Autowired
private ILsAdminService adminService;

@Autowired
private LsAdminMapper lsAdminMapper;

@Autowired
private ILsCityService lsCityService;


/**
* 获取报告列表
*
@@ -101,12 +107,35 @@ public class LSReportServiceImpl extends BaseServiceImpl<LSReportMapper, TauvRep
}
queryWrapper.eq("mark", 1);

// 数据权限
List<Integer> authDataList = adminService.getAdminAuthData(userId);
if (authDataList.contains(1)) {
//
}

// // 数据权限
// Map<Integer, String> authDataList = adminService.getAdminAuthData(userId);
// List<BigInteger> driverAreaList = new ArrayList<>();
//
// LsAdmin lsAdmin = lsAdminMapper.selectById(userId);
//
// // 查看本人负责的河湖
// if (authDataList.contains(1)) {
// if (lsAdmin != null && lsAdmin.getDriverArea() != null) {
// driverAreaList.add(lsAdmin.getDriverArea());
// }
// }
// // 查看本人及下属人员负责的河湖
// if (authDataList.contains(2)) {
// if (lsAdmin != null && lsAdmin.getDriverArea() != null && !driverAreaList.contains(lsAdmin.getDriverArea())) {
// driverAreaList.add(lsAdmin.getDriverArea());
// }
// // 获取下属人员负责的河流
// List<BigInteger> cityIdsList = lsCityService.getChildCityIds(lsAdmin.getDriverArea());
// if (!cityIdsList.isEmpty()) {
// cityIdsList.forEach(item -> {
// driverAreaList.add(item);
// });
// }
// }
// // 查看指定部门下人员负责河湖数据
// if (authDataList.contains(3)) {
//
// }

// 查询数据
IPage<TauvReport> page = new Page<>(query.getPage(), query.getPageSize());

Yükleniyor…
İptal
Kaydet