REQ-2135: 抄送不做ouId=0兼容
This commit is contained in:
parent
2966b05a6e
commit
5d01a704c5
@ -88,12 +88,6 @@ public class PendingMessageBizConfig {
|
||||
@Getter
|
||||
private String genBizCodeTemplates = "";
|
||||
|
||||
/**
|
||||
* 是否直接添加ouId=0的数据去查询待办
|
||||
*/
|
||||
@Getter
|
||||
private boolean todoSearchZeroOuId = true;
|
||||
|
||||
public boolean hasMessageDetailStyle(String code) {
|
||||
return name2DetailStyle != null && name2DetailStyle.containsKey(code);
|
||||
}
|
||||
|
||||
@ -981,16 +981,16 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
}
|
||||
|
||||
private List<Long> appendExecutorOuIdExpr(LambdaQueryChainWrapper<PendingMessageRecord> query, Long ouId) {
|
||||
List<Long> ouIds = determineOuIds(ouId);
|
||||
List<Long> ouIds = determineOuIds(ouId, true);
|
||||
query.in(PendingMessageRecord::getOuId, ouIds);
|
||||
return ouIds;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public List<Long> determineOuIds(Long ouId) {
|
||||
public List<Long> determineOuIds(Long ouId, boolean includeZeroOuId) {
|
||||
List<Long> ouIds = new ArrayList<>();
|
||||
// 1. 查询 ouId = 0 的数据
|
||||
if (pendingMessageBizConfig.isTodoSearchZeroOuId())
|
||||
if (includeZeroOuId)
|
||||
ouIds.add(0L);
|
||||
if (ouId == null)
|
||||
return ouIds;
|
||||
|
||||
@ -127,7 +127,8 @@ public class TodoRangeQueryService {
|
||||
}
|
||||
CopiedToMeParam copiedToMeParam = request.getCopiedToMeParam();
|
||||
Ref<List<Long>> ouCollector = Ref.create();
|
||||
LambdaQueryWrapper<Todo> query = todoQuery(request.getOuId(), ouCollector)
|
||||
OuInfo ouInfo = OuInfo.create(request.getOuId(), request.determineToDoType());
|
||||
LambdaQueryWrapper<Todo> query = todoQuery(ouInfo, ouCollector)
|
||||
// 查询的待办类型: COPIED_TO_ME, EXECUTABLE
|
||||
.eq(Todo::getType, request.determineToDoType())
|
||||
.eq(Todo::getExecutorPersonId, request.getPersonId())
|
||||
@ -258,7 +259,8 @@ public class TodoRangeQueryService {
|
||||
List<String> templateCodes = groupTemplateService.collectTemplateCodes(nodes);
|
||||
if (CollectionUtils.isEmpty(templateCodes))
|
||||
return 0;
|
||||
LambdaQueryWrapper<Todo> query = todoQuery(request.getOuId())
|
||||
OuInfo ouInfo = OuInfo.create(request.getOuId(), todoType);
|
||||
LambdaQueryWrapper<Todo> query = todoQuery(ouInfo)
|
||||
.in(Todo::getTemplateCode, templateCodes)
|
||||
.eq(Todo::getExecutorPersonId, request.getOperator().getId())
|
||||
.and(todoType == TodoType.EXECUTABLE, nested -> nested
|
||||
@ -285,12 +287,12 @@ public class TodoRangeQueryService {
|
||||
.like(StringUtils.isNotBlank(searchPromoterName), TodoBusiness::getPromoterName, searchPromoterName);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Todo> todoQuery(Long ouId) {
|
||||
return todoQuery(ouId, null);
|
||||
private LambdaQueryWrapper<Todo> todoQuery(OuInfo info) {
|
||||
return todoQuery(info, null);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Todo> todoQuery(Long ouId, @Nullable Ref<List<Long>> ouCollector) {
|
||||
List<Long> ouIds = pendingMessageNewServiceImpl.determineOuIds(ouId);
|
||||
private LambdaQueryWrapper<Todo> todoQuery(OuInfo info, @Nullable Ref<List<Long>> ouCollector) {
|
||||
List<Long> ouIds = pendingMessageNewServiceImpl.determineOuIds(info.ouId, info.includeZeroOuId);
|
||||
if (ouCollector != null)
|
||||
ouCollector.set(ouIds);
|
||||
// 1. 查询 ouId = 0 的数据
|
||||
@ -300,4 +302,14 @@ public class TodoRangeQueryService {
|
||||
.in(CollectionUtils.isNotEmpty(ouIds), Todo::getOuId, ouIds);
|
||||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
private static class OuInfo {
|
||||
private final Long ouId;
|
||||
private final boolean includeZeroOuId;
|
||||
|
||||
static OuInfo create(Long ouId, TodoType todoType) {
|
||||
return new OuInfo(ouId, todoType == TodoType.EXECUTABLE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user