fix: 优化逻辑
This commit is contained in:
parent
ae34d93001
commit
098cd094ee
@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@ -35,6 +36,8 @@ import jakarta.annotation.Resource;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.security.core.context.SecurityContext;
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -71,6 +74,9 @@ public class FishDraftDataController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AttachmentUploadService attachmentUploadService;
|
private AttachmentUploadService attachmentUploadService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ThreadPoolTaskExecutor taskExecutor;
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
@Operation(summary = "分页查询过鱼数据(关联电站和设施)")
|
@Operation(summary = "分页查询过鱼数据(关联电站和设施)")
|
||||||
public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
@ -232,6 +238,41 @@ public class FishDraftDataController {
|
|||||||
@Operation(summary = "批量删除草稿(软删除)")
|
@Operation(summary = "批量删除草稿(软删除)")
|
||||||
public ResponseResult batchRemoveDraft(@RequestBody List<String> ids) {
|
public ResponseResult batchRemoveDraft(@RequestBody List<String> ids) {
|
||||||
boolean result = fishDraftDataService.batchRemoveDraft(ids);
|
boolean result = fishDraftDataService.batchRemoveDraft(ids);
|
||||||
|
if(result){
|
||||||
|
List<FishDraftData> list = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().in(FishDraftData::getId, ids).select(FishDraftData::getPicpth, FishDraftData::getVdpth, FishDraftData::getId));
|
||||||
|
// 异步删除附件
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
for (FishDraftData fishDraftData : list) {
|
||||||
|
String picpth = fishDraftData.getPicpth();
|
||||||
|
String vdpth = fishDraftData.getVdpth();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (StrUtil.isNotBlank(picpth)) {
|
||||||
|
// 假设 picpth 是分号或逗号分隔的文件ID/路径
|
||||||
|
List<String> split = StrUtil.split(picpth, StrUtil.C_COMMA);
|
||||||
|
for (String fileId : split) {
|
||||||
|
if (StrUtil.isNotBlank(fileId)) {
|
||||||
|
attachmentUploadService.deleteFile(fileId.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(vdpth)) {
|
||||||
|
List<String> split = StrUtil.split(vdpth, StrUtil.C_COMMA);
|
||||||
|
for (String fileId : split) {
|
||||||
|
if (StrUtil.isNotBlank(fileId)) {
|
||||||
|
attachmentUploadService.deleteFile(fileId.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("异步删除附件失败, dataId: {}", fishDraftData.getId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, taskExecutor).exceptionally(ex -> {
|
||||||
|
log.error("异步删除任务执行异常", ex);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败");
|
return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -284,7 +284,7 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
data.setEnnm(cellValue.trim());
|
data.setEnnm(cellValue.trim());
|
||||||
data.setRstcd(cellValue);
|
data.setRstcd(cellValue);
|
||||||
} else {
|
} else {
|
||||||
String stcd = directStcdList.stream().filter(sdEngInfoBH -> sdEngInfoBH.getEnnm().equals(cellValue.trim())).map(SdEngInfoBH::getStcd).findFirst().get();
|
String stcd = directStcdList.stream().filter(sdEngInfoBH -> sdEngInfoBH.getEnnm().equals(cellValue.trim())).map(SdEngInfoBH::getStcd).findFirst().orElse( null);
|
||||||
if (StrUtil.isBlank(stcd)) {
|
if (StrUtil.isBlank(stcd)) {
|
||||||
importRow.getWarnings().add("rstcd");
|
importRow.getWarnings().add("rstcd");
|
||||||
data.setEnnm(cellValue.trim());
|
data.setEnnm(cellValue.trim());
|
||||||
@ -329,7 +329,7 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
data.setHbrvcd(cellValue);
|
data.setHbrvcd(cellValue);
|
||||||
data.setHbrvnm(cellValue);
|
data.setHbrvnm(cellValue);
|
||||||
} else {
|
} else {
|
||||||
String hbrvcdCode = allowedHbrvcdList.stream().filter(sdHbrvDic -> sdHbrvDic.getHbrvnm().equals(cellValue.trim())).map(SdHbrvDic::getHbrvcd).findFirst().get();
|
String hbrvcdCode = allowedHbrvcdList.stream().filter(sdHbrvDic -> sdHbrvDic.getHbrvnm().equals(cellValue.trim())).map(SdHbrvDic::getHbrvcd).findFirst().orElse( null);
|
||||||
if (StrUtil.isBlank(hbrvcdCode)) {
|
if (StrUtil.isBlank(hbrvcdCode)) {
|
||||||
importRow.getWarnings().add("hbrvcd");
|
importRow.getWarnings().add("hbrvcd");
|
||||||
data.setHbrvcd(cellValue.trim());
|
data.setHbrvcd(cellValue.trim());
|
||||||
@ -510,7 +510,7 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
importRow.getWarnings().add("stcd");
|
importRow.getWarnings().add("stcd");
|
||||||
data.setStcd(cellValue);
|
data.setStcd(cellValue);
|
||||||
} else {
|
} else {
|
||||||
String stcd = sdFpssList.stream().filter(sdFpssBH -> sdFpssBH.getStnm().equals(cellValue.trim())).map(SdFpssBH::getStcd).findFirst().get();
|
String stcd = sdFpssList.stream().filter(sdFpssBH -> sdFpssBH.getStnm().equals(cellValue.trim())).map(SdFpssBH::getStcd).findFirst().orElse( null);
|
||||||
if (StrUtil.isBlank(stcd)) {
|
if (StrUtil.isBlank(stcd)) {
|
||||||
importRow.getWarnings().add("stcd");
|
importRow.getWarnings().add("stcd");
|
||||||
data.setStcd(cellValue.trim());
|
data.setStcd(cellValue.trim());
|
||||||
|
|||||||
@ -164,7 +164,7 @@ public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportT
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean cancelTask(String taskId, String operatorId) {
|
public boolean cancelTask(String taskId, String operatorId) {
|
||||||
ImportTask importTask = this.getById(taskId);
|
ImportTask importTask = this.getOne(new LambdaQueryWrapper<ImportTask>().eq(ImportTask::getId, taskId).select(ImportTask::getId,ImportTask::getStatus, ImportTask::getTempDir));
|
||||||
if (importTask == null) {
|
if (importTask == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -176,9 +176,10 @@ public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportT
|
|||||||
if (StrUtil.isNotBlank( temp)) {
|
if (StrUtil.isNotBlank( temp)) {
|
||||||
FileUtil.del(temp);
|
FileUtil.del(temp);
|
||||||
}else{
|
}else{
|
||||||
if (importTask.getResultJson() != null && !importTask.getResultJson().isEmpty()) {
|
ImportTask importTaskNew = this.getById(taskId);
|
||||||
|
if (importTaskNew.getResultJson() != null && !importTaskNew.getResultJson().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
FishImportResult importResult = objectMapper.readValue(importTask.getResultJson(), FishImportResult.class);
|
FishImportResult importResult = objectMapper.readValue(importTaskNew.getResultJson(), FishImportResult.class);
|
||||||
String tempDir = importResult.getTempDir();
|
String tempDir = importResult.getTempDir();
|
||||||
// del 方法会递归删除目录及其所有内容
|
// del 方法会递归删除目录及其所有内容
|
||||||
FileUtil.del(tempDir);
|
FileUtil.del(tempDir);
|
||||||
|
|||||||
@ -69,110 +69,11 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SdEngInfoBH> selectForDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
public List<SdEngInfoBH> selectForDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
||||||
String userId = SecurityUtils.getUserId();
|
String baseId = sdEngInfoBHRequest.getBaseId();
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String hbrvcd = sdEngInfoBHRequest.getHbrvcd();
|
||||||
|
String ennm = sdEngInfoBHRequest.getEnnm();
|
||||||
// 管理员直接查询
|
List<String> rvcds = sdEngInfoBHRequest.getRvcds();
|
||||||
if ("admin".equals(currentUsername)) {
|
List<String> hbrvcds = sdEngInfoBHRequest.getHbrvcds();
|
||||||
return queryEngInfoList(sdEngInfoBHRequest, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户权限范围
|
|
||||||
List<SysUserDataScope> sysUserDataScopes = sysUserDataScopeMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<SysUserDataScope>()
|
|
||||||
.eq(SysUserDataScope::getUserId, userId)
|
|
||||||
.select(SysUserDataScope::getOrgId, SysUserDataScope::getOrgType)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (sysUserDataScopes == null || sysUserDataScopes.isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 分类权限类型
|
|
||||||
Set<String> stationCodes = new HashSet<>();
|
|
||||||
Set<String> basinCodes = new HashSet<>();
|
|
||||||
|
|
||||||
for (SysUserDataScope scope : sysUserDataScopes) {
|
|
||||||
String orgType = scope.getOrgType();
|
|
||||||
String orgId = scope.getOrgId();
|
|
||||||
|
|
||||||
if ("STATION".equals(orgType)) {
|
|
||||||
stationCodes.add(orgId);
|
|
||||||
} else if ("HBRVCD".equals(orgType)) {
|
|
||||||
basinCodes.add(orgId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果有具体站点权限且数量较少,直接使用 IN
|
|
||||||
if (!stationCodes.isEmpty() && stationCodes.size() <= 100) {
|
|
||||||
return queryEngInfoList(sdEngInfoBHRequest, stationCodes, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果只有流域权限或站点数量过多,使用流域过滤
|
|
||||||
if (!basinCodes.isEmpty()) {
|
|
||||||
return queryEngInfoList(sdEngInfoBHRequest, null, basinCodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 站点数量过多但没有流域信息,分批查询
|
|
||||||
if (!stationCodes.isEmpty()) {
|
|
||||||
return queryEngInfoByBatches(sdEngInfoBHRequest, stationCodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询工程信息列表
|
|
||||||
*/
|
|
||||||
private List<SdEngInfoBH> queryEngInfoList(SdEngInfoBHRequest request,
|
|
||||||
Set<String> stationCodes,
|
|
||||||
Set<String> basinCodes) {
|
|
||||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = buildQueryWrapper(request);
|
|
||||||
|
|
||||||
// 添加权限过滤
|
|
||||||
if (stationCodes != null && !stationCodes.isEmpty()) {
|
|
||||||
wrapper.in(SdEngInfoBH::getStcd, stationCodes);
|
|
||||||
} else if (basinCodes != null && !basinCodes.isEmpty()) {
|
|
||||||
wrapper.in(SdEngInfoBH::getHbrvcd, basinCodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.list(wrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分批查询(当站点数量过多时)
|
|
||||||
*/
|
|
||||||
private List<SdEngInfoBH> queryEngInfoByBatches(SdEngInfoBHRequest request, Set<String> stationCodes) {
|
|
||||||
List<SdEngInfoBH> result = new ArrayList<>();
|
|
||||||
int batchSize = 100; // 每批最多 100 个站点
|
|
||||||
|
|
||||||
List<String> stationList = new ArrayList<>(stationCodes);
|
|
||||||
for (int i = 0; i < stationList.size(); i += batchSize) {
|
|
||||||
int end = Math.min(i + batchSize, stationList.size());
|
|
||||||
List<String> batch = stationList.subList(i, end);
|
|
||||||
|
|
||||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = buildQueryWrapper(request);
|
|
||||||
wrapper.in(SdEngInfoBH::getStcd, batch);
|
|
||||||
|
|
||||||
List<SdEngInfoBH> batchResult = this.list(wrapper);
|
|
||||||
if (batchResult != null && !batchResult.isEmpty()) {
|
|
||||||
result.addAll(batchResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建查询条件
|
|
||||||
*/
|
|
||||||
private LambdaQueryWrapper<SdEngInfoBH> buildQueryWrapper(SdEngInfoBHRequest request) {
|
|
||||||
String baseId = request.getBaseId();
|
|
||||||
String hbrvcd = request.getHbrvcd();
|
|
||||||
String ennm = request.getEnnm();
|
|
||||||
List<String> rvcds = request.getRvcds();
|
|
||||||
List<String> hbrvcds = request.getHbrvcds();
|
|
||||||
|
|
||||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
||||||
.eq(StringUtils.hasText(hbrvcd), SdEngInfoBH::getHbrvcd, hbrvcd)
|
.eq(StringUtils.hasText(hbrvcd), SdEngInfoBH::getHbrvcd, hbrvcd)
|
||||||
@ -182,9 +83,19 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
.select(SdEngInfoBH::getStcd, SdEngInfoBH::getEnnm, SdEngInfoBH::getBaseId)
|
.select(SdEngInfoBH::getStcd, SdEngInfoBH::getEnnm, SdEngInfoBH::getBaseId)
|
||||||
.orderByAsc(SdEngInfoBH::getOrderIndex);
|
.orderByAsc(SdEngInfoBH::getOrderIndex);
|
||||||
|
|
||||||
return wrapper;
|
if("admin".equals(SecurityUtils.getCurrentUsername())){
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||||
|
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
||||||
|
List<SdEngInfoBH> list = this.list(wrapper);
|
||||||
|
return list.stream()
|
||||||
|
.filter(item -> authorizedStations.contains(item.getStcd()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}else{
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getUserAuthorizedStationCodes() {
|
public Set<String> getUserAuthorizedStationCodes() {
|
||||||
String userId = SecurityUtils.getUserId();
|
String userId = SecurityUtils.getUserId();
|
||||||
|
|||||||
@ -67,28 +67,42 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SdFpssBH> selectForDropdown(String rstcd, String stnm, String baseId) {
|
public List<SdFpssBH> selectForDropdown(String rstcd, String stnm, String baseId) {
|
||||||
|
// 管理员直接查询,无需权限过滤
|
||||||
|
if ("admin".equals(SecurityUtils.getCurrentUsername())) {
|
||||||
|
return queryFpssList(rstcd, stnm, baseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户有权限的工程编码
|
||||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||||
|
|
||||||
List<SdFpssBH> result;
|
// 无权限直接返回空列表
|
||||||
|
if (authorizedStations == null || authorizedStations.isEmpty()) {
|
||||||
if (StringUtils.hasText(baseId)) {
|
return new ArrayList<>();
|
||||||
result = baseMapper.selectForDropdownWithBaseId(rstcd, stnm, baseId);
|
|
||||||
} else {
|
|
||||||
LambdaQueryWrapper<SdFpssBH> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(StringUtils.hasText(rstcd), SdFpssBH::getRstcd, rstcd)
|
|
||||||
.like(StringUtils.hasText(stnm), SdFpssBH::getStnm, stnm)
|
|
||||||
.orderByDesc(SdFpssBH::getOrderIndex);
|
|
||||||
result = list(wrapper);
|
|
||||||
}
|
|
||||||
if (authorizedStations.isEmpty()&&"admin".equals(SecurityUtils.getCurrentUsername())) {
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询数据
|
||||||
|
List<SdFpssBH> result = queryFpssList(rstcd, stnm, baseId);
|
||||||
|
|
||||||
|
// 权限过滤
|
||||||
return result.stream()
|
return result.stream()
|
||||||
.filter(fpss -> authorizedStations.contains(fpss.getRstcd()))
|
.filter(fpss -> fpss.getRstcd() != null && authorizedStations.contains(fpss.getRstcd()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询过鱼设施列表(公共方法)
|
||||||
|
*/
|
||||||
|
private List<SdFpssBH> queryFpssList(String rstcd, String stnm, String baseId) {
|
||||||
|
if (StringUtils.hasText(baseId)) {
|
||||||
|
return baseMapper.selectForDropdownWithBaseId(rstcd, stnm, baseId);
|
||||||
|
} else {
|
||||||
|
LambdaQueryWrapper<SdFpssBH> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(StringUtils.hasText(rstcd), SdFpssBH::getRstcd, rstcd)
|
||||||
|
.like(StringUtils.hasText(stnm), SdFpssBH::getStnm, stnm)
|
||||||
|
.orderByDesc(SdFpssBH::getOrderIndex);
|
||||||
|
return list(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getUserAuthorizedStationCodes() {
|
public Set<String> getUserAuthorizedStationCodes() {
|
||||||
String userId = SecurityUtils.getUserId();
|
String userId = SecurityUtils.getUserId();
|
||||||
|
|||||||
@ -92,8 +92,16 @@ public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SdHbrvDic> selectForDropdown(String hbrvnm, String baseid) {
|
public List<SdHbrvDic> selectForDropdown(String hbrvnm, String baseid) {
|
||||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
|
||||||
LambdaQueryWrapper<SdHbrvDic> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SdHbrvDic> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.like(hbrvnm != null && !hbrvnm.isEmpty(), SdHbrvDic::getHbrvnm, hbrvnm)
|
||||||
|
.eq(baseid != null && !baseid.isEmpty(), SdHbrvDic::getBaseid, baseid)
|
||||||
|
.eq(SdHbrvDic::getEnabled, 1)
|
||||||
|
.orderByAsc(SdHbrvDic::getOrderIndex);
|
||||||
|
if("admin".equals(SecurityUtils.getCurrentUsername())){
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||||
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
||||||
List<SdEngInfoBH> engInfos = engInfoBHMapper.selectList(
|
List<SdEngInfoBH> engInfos = engInfoBHMapper.selectList(
|
||||||
new LambdaQueryWrapper<SdEngInfoBH>()
|
new LambdaQueryWrapper<SdEngInfoBH>()
|
||||||
@ -104,21 +112,19 @@ public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic
|
|||||||
.map(SdEngInfoBH::getHbrvcd)
|
.map(SdEngInfoBH::getHbrvcd)
|
||||||
.filter(id -> id != null && !id.isEmpty())
|
.filter(id -> id != null && !id.isEmpty())
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
if (!hbrvcds.isEmpty()) {
|
if (!hbrvcds.isEmpty()) {
|
||||||
wrapper.in(SdHbrvDic::getHbrvcd, hbrvcds);
|
List<SdHbrvDic> list = this.list(wrapper);
|
||||||
|
return list.stream()
|
||||||
|
.filter(hbrvDic -> hbrvcds.contains(hbrvDic.getHbrvcd()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}else if (!"admin".equals(SecurityUtils.getCurrentUsername())){
|
}else {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
wrapper.like(hbrvnm != null && !hbrvnm.isEmpty(), SdHbrvDic::getHbrvnm, hbrvnm)
|
|
||||||
.eq(baseid != null && !baseid.isEmpty(), SdHbrvDic::getBaseid, baseid)
|
|
||||||
.eq(SdHbrvDic::getEnabled, 1)
|
|
||||||
.orderByAsc(SdHbrvDic::getOrderIndex);
|
|
||||||
return this.list(wrapper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user