|
|
@@ -1,7 +1,9 @@
|
|
|
package com.github.jfcloud.gene.sample.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
+import cn.hutool.core.lang.Pair;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
@@ -196,11 +198,13 @@ public class SampleInfoServiceImpl extends ServiceImpl<SampleInfoMapper, SampleI
|
|
|
.eq(Objects.nonNull(vo.getApplicantId()), SampleInfo::getApplicantId, vo.getApplicantId())
|
|
|
.eq(SampleInfo::getDeleted, YesNoEnum.NO.getCode())
|
|
|
.orderByDesc(SampleInfo::getApplyTime, SampleInfo::getCreateTime);
|
|
|
+
|
|
|
+ List<String> statusList = new ArrayList<>();
|
|
|
if (StrUtil.isNotBlank(vo.getStatus())) {
|
|
|
if (vo.getStatus().contains(",")) {
|
|
|
- wrapper.in(SampleInfo::getStatus, vo.getStatus().split(","));
|
|
|
+ statusList.addAll(Arrays.asList(vo.getStatus().split(",")));
|
|
|
} else {
|
|
|
- wrapper.eq(SampleInfo::getStatus, vo.getStatus());
|
|
|
+ statusList.add(vo.getStatus());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -209,13 +213,15 @@ public class SampleInfoServiceImpl extends ServiceImpl<SampleInfoMapper, SampleI
|
|
|
.like(SampleInfo::getProjectName, vo.getProject()));
|
|
|
}
|
|
|
DataScope dataScope = DataScope.of();
|
|
|
- //选择了审核状态,则只能看到自己审核的
|
|
|
- if (GeneStatusEnum.DEPART_LEADER.getStatus().equals(vo.getStatus())) {
|
|
|
- wrapper.eq(SampleInfo::getDepartLeaderId, UserUtil.getUserId());
|
|
|
- dataScope = null;
|
|
|
- } else if (GeneStatusEnum.PROJECT_MANAGEMENT.getStatus().equals(vo.getStatus())) {
|
|
|
- wrapper.eq(SampleInfo::getProjectManageId, UserUtil.getUserId());
|
|
|
- dataScope = null;
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(statusList)) {
|
|
|
+ Optional<Pair<String, String>> opt = GeneStatusEnum.getSampleAuditStatusList().stream()
|
|
|
+ .filter(x -> statusList.contains(x.getKey()))
|
|
|
+ .findAny();
|
|
|
+ if (opt.isPresent()) {
|
|
|
+ dataScope = null;
|
|
|
+ wrapper.and(x -> queryStatus(statusList, x));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Page<SampleInfo> page = baseMapper.selectPageByScope(pageQuery, wrapper, dataScope);
|
|
|
@@ -241,6 +247,17 @@ public class SampleInfoServiceImpl extends ServiceImpl<SampleInfoMapper, SampleI
|
|
|
return pageResult;
|
|
|
}
|
|
|
|
|
|
+ private void queryStatus(List<String> statusList, LambdaQueryWrapper<SampleInfo> lqw2) {
|
|
|
+ //选择了审核状态,则只能看到自己审核的
|
|
|
+ for (String sta : statusList) {
|
|
|
+ if (GeneStatusEnum.DEPART_LEADER.getStatus().equals(sta)) {
|
|
|
+ lqw2.or(x -> x.eq(SampleInfo::getDepartLeaderId, UserUtil.getUserId()));
|
|
|
+ } else if (GeneStatusEnum.PROJECT_MANAGEMENT.getStatus().equals(sta)) {
|
|
|
+ lqw2.or(x -> x.eq(SampleInfo::getProjectManageId, UserUtil.getUserId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public SampleDetailDto getDetail(Long id) {
|
|
|
SampleInfo sampleInfo = getById(id);
|