Browse Source

新增区划数据权限

master
牧羊人 4 years ago
parent
commit
0d56a3acbf
8 changed files with 255 additions and 45 deletions
  1. +9
    -0
      src/main/java/com/taauav/front/service/IUserAuthGroupService.java
  2. +58
    -1
      src/main/java/com/taauav/front/service/impl/UserAuthGroupServiceImpl.java
  3. +18
    -1
      src/main/java/com/taauav/front/service/impl/UserInspectDriverServiceImpl.java
  4. +32
    -7
      src/main/java/com/taauav/front/service/impl/UserInspectQuestionServiceImpl.java
  5. +36
    -11
      src/main/java/com/taauav/front/service/impl/UserWaterAlarmServiceImpl.java
  6. +33
    -7
      src/main/java/com/taauav/front/service/impl/UserWaterDataServiceImpl.java
  7. +32
    -7
      src/main/java/com/taauav/front/service/impl/UserWaterSpectrumServiceImpl.java
  8. +37
    -11
      src/main/java/com/taauav/front/service/impl/UserWaterWarnServiceImpl.java

+ 9
- 0
src/main/java/com/taauav/front/service/IUserAuthGroupService.java View File

import com.taauav.front.entity.UserAuthGroup; import com.taauav.front.entity.UserAuthGroup;
import com.taauav.front.query.UserAuthGroupQuery; import com.taauav.front.query.UserAuthGroupQuery;


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


/** /**
*/ */
List<UserAuthGroup> getAuthGroups(Integer adminId); List<UserAuthGroup> getAuthGroups(Integer adminId);


/**
* 根据用户ID获取数据权限
*
* @param userId 用户ID
* @return
*/
List<BigInteger> getDriverAreaList(Integer userId);

} }

+ 58
- 1
src/main/java/com/taauav/front/service/impl/UserAuthGroupServiceImpl.java View File

import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.SysAuthGroup; import com.taauav.admin.entity.SysAuthGroup;
import com.taauav.admin.service.ISysCityService;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl; import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.StringUtils; import com.taauav.common.util.StringUtils;
import com.taauav.front.entity.UserAdmin;
import com.taauav.front.entity.UserAuthGroup; import com.taauav.front.entity.UserAuthGroup;
import com.taauav.front.mapper.UserAdminMapper;
import com.taauav.front.mapper.UserAuthGroupMapper; import com.taauav.front.mapper.UserAuthGroupMapper;
import com.taauav.front.query.UserAuthGroupQuery; import com.taauav.front.query.UserAuthGroupQuery;
import com.taauav.front.service.IUserAdminService;
import com.taauav.front.service.IUserAuthGroupService; import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.utils.LoginUtils;
import com.taauav.front.vo.UserAuthGroupListVo; import com.taauav.front.vo.UserAuthGroupListVo;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


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


@Autowired @Autowired
private UserAuthGroupMapper userAuthGroupMapper; private UserAuthGroupMapper userAuthGroupMapper;

@Autowired
private UserAdminMapper userAdminMapper;
@Autowired
private IUserAdminService userAdminService;
@Autowired
private ISysCityService cityService;
@Autowired @Autowired
private Response response; private Response response;


return userAuthGroupMapper.getAuthGroups(adminId); return userAuthGroupMapper.getAuthGroups(adminId);
} }


/**
* 根据用户ID获取数据权限
*
* @param userId 用户ID
* @return
*/
@Override
public List<BigInteger> getDriverAreaList(Integer userId) {
List<BigInteger> driverAreaList = new ArrayList<>();
// 获取当前登录人员信息
UserAdmin userAdmin = userAdminMapper.selectById(userId);
// 遍历数据权限
Map<Integer, String> map = userAdminService.getAdminAuthData(userId);
for (Map.Entry<Integer, String> entry : map.entrySet()) {
if (entry.getKey() == 1) {
// 查看本人负责的河湖
if (userAdmin.getDriverArea() != null && !driverAreaList.contains(userAdmin.getDriverArea())) {
driverAreaList.add(userAdmin.getDriverArea());
}
} else if (entry.getKey() == 2) {
// 查看本人及下属人员负责的河湖
if (userAdmin.getDriverArea() != null && !driverAreaList.contains(userAdmin.getDriverArea())) {
driverAreaList.add(userAdmin.getDriverArea());
}
// 获取下属人员负责的河流
List<BigInteger> cityIdsList = cityService.getChildCityIds(userAdmin.getDriverArea());
if (!cityIdsList.isEmpty()) {
cityIdsList.forEach(item -> {
driverAreaList.add(item);
});
}
} else if (entry.getKey() == 3) {
// 查看指定部门下人员负责河湖数据
if (!com.taauav.common.util.StringUtils.isEmpty(entry.getValue())) {
String[] itemArr = entry.getValue().split(",");
for (String s : itemArr) {
if (driverAreaList.contains(userAdmin.getDriverArea())) {
continue;
}
driverAreaList.add(BigInteger.valueOf(Long.valueOf(s)));
}
}
}
}
return driverAreaList;
}
} }

+ 18
- 1
src/main/java/com/taauav/front/service/impl/UserInspectDriverServiceImpl.java View File

import com.taauav.front.dto.IndexInspectDto; import com.taauav.front.dto.IndexInspectDto;
import com.taauav.front.mapper.UserAdminMapper; import com.taauav.front.mapper.UserAdminMapper;
import com.taauav.front.service.IUserAdminService; import com.taauav.front.service.IUserAdminService;
import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.service.IUserInspectDriverService; import com.taauav.front.service.IUserInspectDriverService;
import com.taauav.front.utils.LoginUtils;
import com.taauav.front.vo.IndexInspectFileVo; import com.taauav.front.vo.IndexInspectFileVo;
import com.taauav.front.vo.IndexInspectListVo; import com.taauav.front.vo.IndexInspectListVo;
import com.taauav.front.vo.UserAdminVo; import com.taauav.front.vo.UserAdminVo;


import java.io.File; import java.io.File;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*; import java.util.*;


/** /**
private TauvInspectMapper inspectMapper; private TauvInspectMapper inspectMapper;
@Autowired @Autowired
private ITauvInspectFileService inspectFileService; private ITauvInspectFileService inspectFileService;
@Autowired
private IUserAuthGroupService userAuthGroupService;


@Override @Override
public String batchAddData(TauvInspect inspect) { public String batchAddData(TauvInspect inspect) {
} else { } else {
map = new HashMap<>(); map = new HashMap<>();
} }
// 数据权限
if (ShiroUtils.getAdminId() != 1) {
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(ShiroUtils.getAdminId());
if (StringUtils.isEmpty(map.get("driverArea"))) {
// 获取数据权限
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]);
map.put("driverArea", driverArea);
} else if (!driverAreaList.contains(BigInteger.valueOf(Long.valueOf((((String[]) map.get("driverArea"))[0]))))) {
map.put("driverArea", new String[]{"-1"});
}
}
Page<TauvInspectDriverDTO> page = new Page<>(pageNo, pageSize); Page<TauvInspectDriverDTO> page = new Page<>(pageNo, pageSize);
List<TauvInspectDriverDTO> data = inspectDriverMapper.getPageList(page, map); List<TauvInspectDriverDTO> data = inspectDriverMapper.getPageList(page, map);
TauvInspect tauvInspect = new TauvInspect(); TauvInspect tauvInspect = new TauvInspect();
// 执行中 // 执行中
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("mark", 1); wrapper.eq("mark", 1);
wrapper.in("status", 3,5,6);
wrapper.in("status", 3, 5, 6);
Integer inExecution = count(wrapper); Integer inExecution = count(wrapper);
// 已完成 // 已完成
QueryWrapper wrapper1 = new QueryWrapper(); QueryWrapper wrapper1 = new QueryWrapper();


/** /**
* 指挥大屏-任务管理列表 * 指挥大屏-任务管理列表
*
* @param indexInspectDto * @param indexInspectDto
* @return * @return
*/ */

+ 32
- 7
src/main/java/com/taauav/front/service/impl/UserInspectQuestionServiceImpl.java View File

import com.taauav.front.mapper.UserAdminMapper; import com.taauav.front.mapper.UserAdminMapper;
import com.taauav.front.mapper.UserInspectQuestionMapper; import com.taauav.front.mapper.UserInspectQuestionMapper;
import com.taauav.front.query.UserInspectQuestionQuery; import com.taauav.front.query.UserInspectQuestionQuery;
import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.service.IUserInspectQuestionService; import com.taauav.front.service.IUserInspectQuestionService;
import com.taauav.front.vo.IndexQuestionDetailVo; import com.taauav.front.vo.IndexQuestionDetailVo;
import com.taauav.front.vo.IndexQuestionListVo; import com.taauav.front.vo.IndexQuestionListVo;
private ISysCityService sysCityService; private ISysCityService sysCityService;
@Autowired @Autowired
private UserAdminMapper userAdminMapper; private UserAdminMapper userAdminMapper;
@Autowired
private IUserAuthGroupService userAuthGroupService;


@Value("${server.UPLOAD_URL}") @Value("${server.UPLOAD_URL}")
private String uploadUrl; private String uploadUrl;
*/ */
@Override @Override
public Response getList(UserInspectQuestionQuery query) { public Response getList(UserInspectQuestionQuery query) {
// 区划ID处理
if (query.getDriverArea() != null) {
List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// 加入当前选中的区划
cityIds.add(query.getDriverArea());
BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
query.setDriverAreaList(integers);
// // 区划ID处理
// if (query.getDriverArea() != null) {
// List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// // 加入当前选中的区划
// cityIds.add(query.getDriverArea());
// BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
// query.setDriverAreaList(integers);
// }
// 数据权限
if (ShiroUtils.getAdminId() != 1) {
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(ShiroUtils.getAdminId());
if (StringUtils.isEmpty(query.getDriverArea())) {
// 获取数据权限
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]);
query.setDriverAreaList(driverArea);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
if (driverAreaList.contains(query.getDriverArea())) {
bigIntegerList.add(query.getDriverArea());
query.setDriverAreaList(bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} else {
bigIntegerList.add(BigInteger.valueOf(Long.valueOf("-1")));
query.setDriverAreaList(bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
}
}
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
bigIntegerList.add(query.getDriverArea());
query.setDriverAreaList(bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} }
// 巡检时间处理 // 巡检时间处理
if (!StringUtils.isEmpty(query.getInspectTime())) { if (!StringUtils.isEmpty(query.getInspectTime())) {

+ 36
- 11
src/main/java/com/taauav/front/service/impl/UserWaterAlarmServiceImpl.java View File

import com.taauav.front.mapper.UserInspectQuestionMapper; import com.taauav.front.mapper.UserInspectQuestionMapper;
import com.taauav.front.mapper.UserWaterAlarmMapper; import com.taauav.front.mapper.UserWaterAlarmMapper;
import com.taauav.front.query.UserWaterAlarmQuery; import com.taauav.front.query.UserWaterAlarmQuery;
import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.service.IUserWaterAlarmInfoService; import com.taauav.front.service.IUserWaterAlarmInfoService;
import com.taauav.front.service.IUserWaterAlarmService; import com.taauav.front.service.IUserWaterAlarmService;
import com.taauav.front.vo.wateralarm.UserWaterAlarmInfoListVo; import com.taauav.front.vo.wateralarm.UserWaterAlarmInfoListVo;
private IUserWaterAlarmInfoService userWaterAlarmInfoService; private IUserWaterAlarmInfoService userWaterAlarmInfoService;
@Autowired @Autowired
private UserInspectQuestionMapper userInspectQuestionMapper; private UserInspectQuestionMapper userInspectQuestionMapper;
@Autowired
private IUserAuthGroupService userAuthGroupService;


/** /**
* 获取水质报警列表 * 获取水质报警列表
if (!StringUtils.isEmpty(query.getAlarmSn())) { if (!StringUtils.isEmpty(query.getAlarmSn())) {
queryWrapper.like("alarm_sn", query.getAlarmSn()); queryWrapper.like("alarm_sn", query.getAlarmSn());
} }
// 区划ID
if (query.getDriverArea() != null) {
// 获取所有自己区划ID
List<BigInteger> driverAreaList = new ArrayList<>();
driverAreaList.add(query.getDriverArea());
List<BigInteger> cityIdsList = sysCityService.getChildCityIds(query.getDriverArea());
if (!cityIdsList.isEmpty()) {
cityIdsList.forEach(item -> {
driverAreaList.add(item);
});
// // 区划ID
// if (query.getDriverArea() != null) {
// // 获取所有自己区划ID
// List<BigInteger> driverAreaList = new ArrayList<>();
// driverAreaList.add(query.getDriverArea());
// List<BigInteger> cityIdsList = sysCityService.getChildCityIds(query.getDriverArea());
// if (!cityIdsList.isEmpty()) {
// cityIdsList.forEach(item -> {
// driverAreaList.add(item);
// });
// }
// queryWrapper.in("driver_area", driverAreaList);
// }
// 数据权限
if (ShiroUtils.getAdminId() != 1) {
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(ShiroUtils.getAdminId());
if (org.springframework.util.StringUtils.isEmpty(query.getDriverArea())) {
// 获取数据权限
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]);
queryWrapper.in("driver_area", driverArea);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
if (driverAreaList.contains(query.getDriverArea())) {
bigIntegerList.add(query.getDriverArea());
queryWrapper.in("driver_area", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} else {
bigIntegerList.add(BigInteger.valueOf(Long.valueOf("-1")));
queryWrapper.in("driver_area", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
}
} }
queryWrapper.in("driver_area", driverAreaList);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
bigIntegerList.add(query.getDriverArea());
queryWrapper.in("driver_area", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} }
// 河湖名称 // 河湖名称
if (!StringUtils.isEmpty(query.getDriverName())) { if (!StringUtils.isEmpty(query.getDriverName())) {

+ 33
- 7
src/main/java/com/taauav/front/service/impl/UserWaterDataServiceImpl.java View File

import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl; import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils; import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.ShiroUtils;
import com.taauav.front.mapper.UserWaterDataMapper; import com.taauav.front.mapper.UserWaterDataMapper;
import com.taauav.front.query.UserWaterDataQuery; import com.taauav.front.query.UserWaterDataQuery;
import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.service.IUserWaterDataService; import com.taauav.front.service.IUserWaterDataService;
import com.taauav.front.vo.waterdata.UserWaterDataListVo; import com.taauav.front.vo.waterdata.UserWaterDataListVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;


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


/** /**


@Autowired @Autowired
private UserWaterDataMapper userWaterDataMapper; private UserWaterDataMapper userWaterDataMapper;
@Autowired
private IUserAuthGroupService userAuthGroupService;


@Autowired @Autowired
private Response response; private Response response;
*/ */
@Override @Override
public Response getList(UserWaterDataQuery query) { public Response getList(UserWaterDataQuery query) {
// 区划ID处理
if (query.getDriverArea() != null) {
List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// 加入当前选中的区划
cityIds.add(query.getDriverArea());
BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
query.setDriverAreaList(integers);
// // 区划ID处理
// if (query.getDriverArea() != null) {
// List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// // 加入当前选中的区划
// cityIds.add(query.getDriverArea());
// BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
// query.setDriverAreaList(integers);
// }
if (ShiroUtils.getAdminId() != 1) {
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(ShiroUtils.getAdminId());
if (org.springframework.util.StringUtils.isEmpty(query.getDriverArea())) {
// 获取数据权限
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]);
query.setDriverAreaList(driverArea);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
if (driverAreaList.contains(query.getDriverArea())) {
bigIntegerList.add(query.getDriverArea());
query.setDriverAreaList(bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} else {
bigIntegerList.add(BigInteger.valueOf(Long.valueOf("-1")));
query.setDriverAreaList(bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
}
}
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
bigIntegerList.add(query.getDriverArea());
query.setDriverAreaList(bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} }
// 巡检时间处理 // 巡检时间处理
if (!StringUtils.isEmpty(query.getInspectTime())) { if (!StringUtils.isEmpty(query.getInspectTime())) {

+ 32
- 7
src/main/java/com/taauav/front/service/impl/UserWaterSpectrumServiceImpl.java View File

import com.taauav.common.service.impl.BaseServiceImpl; import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils; import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.RedisUtils; import com.taauav.common.util.RedisUtils;
import com.taauav.common.util.ShiroUtils;
import com.taauav.front.mapper.UserWaterSpectrumMapper; import com.taauav.front.mapper.UserWaterSpectrumMapper;
import com.taauav.front.query.UserWaterSpectrumQuery; import com.taauav.front.query.UserWaterSpectrumQuery;
import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.service.IUserWaterSpectrumService; import com.taauav.front.service.IUserWaterSpectrumService;
import com.taauav.front.vo.IndexDriverVo; import com.taauav.front.vo.IndexDriverVo;
import com.taauav.front.vo.userwaterspectrum.UserWaterSpectrumListVo; import com.taauav.front.vo.userwaterspectrum.UserWaterSpectrumListVo;
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
private ITauvDriverService driverService; private ITauvDriverService driverService;
@Autowired
private IUserAuthGroupService userAuthGroupService;


/** /**
* 获取多光谱数据列表 * 获取多光谱数据列表
if (!StringUtils.isEmpty(query.getInspectNo())) { if (!StringUtils.isEmpty(query.getInspectNo())) {
queryWrapper.like("inspect_no", query.getInspectNo()); queryWrapper.like("inspect_no", query.getInspectNo());
} }
// 区划ID处理
if (query.getDriverArea() != null) {
List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// 加入当前选中的区划
cityIds.add(query.getDriverArea());
BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
queryWrapper.in("area_id", integers);
// // 区划ID处理
// if (query.getDriverArea() != null) {
// List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// // 加入当前选中的区划
// cityIds.add(query.getDriverArea());
// BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
// queryWrapper.in("area_id", integers);
// }
if (ShiroUtils.getAdminId() != 1) {
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(ShiroUtils.getAdminId());
if (org.springframework.util.StringUtils.isEmpty(query.getDriverArea())) {
// 获取数据权限
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]);
queryWrapper.in("area_id", driverArea);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
if (driverAreaList.contains(query.getDriverArea())) {
bigIntegerList.add(query.getDriverArea());
queryWrapper.in("area_id", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} else {
bigIntegerList.add(BigInteger.valueOf(Long.valueOf("-1")));
queryWrapper.in("area_id", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
}
}
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
bigIntegerList.add(query.getDriverArea());
queryWrapper.in("area_id", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} }
// 河道名称 // 河道名称
if (!StringUtils.isEmpty(query.getDriverName())) { if (!StringUtils.isEmpty(query.getDriverName())) {

+ 37
- 11
src/main/java/com/taauav/front/service/impl/UserWaterWarnServiceImpl.java View File

import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl; import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils; import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils; import com.taauav.common.util.StringUtils;
import com.taauav.front.constant.UserWaterWarnConstant; import com.taauav.front.constant.UserWaterWarnConstant;
import com.taauav.front.mapper.UserWaterWarnMapper; import com.taauav.front.mapper.UserWaterWarnMapper;
import com.taauav.front.query.UserWaterWarnQuery; import com.taauav.front.query.UserWaterWarnQuery;
import com.taauav.front.service.IUserAuthGroupService;
import com.taauav.front.service.IUserWaterWarnService; import com.taauav.front.service.IUserWaterWarnService;
import com.taauav.front.vo.waterwarn.UserWaterWarnListVo; import com.taauav.front.vo.waterwarn.UserWaterWarnListVo;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;


@Autowired @Autowired
private ISysCityService sysCityService; private ISysCityService sysCityService;
@Autowired
private IUserAuthGroupService userAuthGroupService;


@Autowired @Autowired
private Response response; private Response response;
if (!StringUtils.isEmpty(query.getWarnSn())) { if (!StringUtils.isEmpty(query.getWarnSn())) {
queryWrapper.like("warn_sn", query.getWarnSn()); queryWrapper.like("warn_sn", query.getWarnSn());
} }
// 区划ID
if (query.getDriverArea() != null) {
// 获取所有自己区划ID
List<BigInteger> driverAreaList = new ArrayList<>();
driverAreaList.add(query.getDriverArea());
List<BigInteger> cityIdsList = sysCityService.getChildCityIds(query.getDriverArea());
if (!cityIdsList.isEmpty()) {
cityIdsList.forEach(item -> {
driverAreaList.add(item);
});
// // 区划ID
// if (query.getDriverArea() != null) {
// // 获取所有自己区划ID
// List<BigInteger> driverAreaList = new ArrayList<>();
// driverAreaList.add(query.getDriverArea());
// List<BigInteger> cityIdsList = sysCityService.getChildCityIds(query.getDriverArea());
// if (!cityIdsList.isEmpty()) {
// cityIdsList.forEach(item -> {
// driverAreaList.add(item);
// });
// }
// queryWrapper.in("driver_area", driverAreaList);
// }
// 数据权限
if (ShiroUtils.getAdminId() != 1) {
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(ShiroUtils.getAdminId());
if (org.springframework.util.StringUtils.isEmpty(query.getDriverArea())) {
// 获取数据权限
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]);
queryWrapper.in("driver_area", driverArea);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
if (driverAreaList.contains(query.getDriverArea())) {
bigIntegerList.add(query.getDriverArea());
queryWrapper.in("driver_area", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} else {
bigIntegerList.add(BigInteger.valueOf(Long.valueOf("-1")));
queryWrapper.in("driver_area", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
}
} }
queryWrapper.in("driver_area", driverAreaList);
} else {
List<BigInteger> bigIntegerList = new ArrayList<>();
bigIntegerList.add(query.getDriverArea());
queryWrapper.in("driver_area", bigIntegerList.toArray(new BigInteger[bigIntegerList.size()]));
} }
// 河湖名称 // 河湖名称
if (!StringUtils.isEmpty(query.getDriverName())) { if (!StringUtils.isEmpty(query.getDriverName())) {

Loading…
Cancel
Save