fix: 修复流水线任务指定设计师模式在审核时被发布到大厅的严重bug
This commit is contained in:
parent
ec5a1317d9
commit
4d582170aa
@ -332,10 +332,17 @@ public class TaskService {
|
||||
// 设置发布类型(从前端传递,默认为recruitment)
|
||||
task.setReleaseType(dto.getReleaseType() != null ? dto.getReleaseType() : "recruitment");
|
||||
// 如果是assigned模式,设置接收人
|
||||
if ("assigned".equals(dto.getReleaseType()) && dto.getReceiverId() != null) {
|
||||
task.setReceiverId(dto.getReceiverId());
|
||||
// 对于流水线任务,如果主任务receiverId为空,从第一个子任务获取
|
||||
Long mainReceiverId = dto.getReceiverId();
|
||||
if ("assigned".equals(dto.getReleaseType()) && mainReceiverId == null && dto.getItems() != null && !dto.getItems().isEmpty()) {
|
||||
// 从第一个子任务获取指定的设计师
|
||||
mainReceiverId = dto.getItems().get(0).getReceiverId();
|
||||
log.info("流水线任务assigned模式,从第一个子任务获取receiverId: {}", mainReceiverId);
|
||||
}
|
||||
if ("assigned".equals(dto.getReleaseType()) && mainReceiverId != null) {
|
||||
task.setReceiverId(mainReceiverId);
|
||||
// 获取接收人的部门ID
|
||||
User receiver = userService.getUserById(dto.getReceiverId());
|
||||
User receiver = userService.getUserById(mainReceiverId);
|
||||
if (receiver != null && receiver.getDeptId() != null) {
|
||||
task.setReceiverDeptId(receiver.getDeptId());
|
||||
}
|
||||
@ -476,6 +483,19 @@ public class TaskService {
|
||||
item.setEstimatedHours(groupTotalHours);
|
||||
item.setSortOrder(itemIndex);
|
||||
item.setProgress(0);
|
||||
|
||||
// 如果是assigned模式,设置子任务的接收人(从该组的第一个任务项获取)
|
||||
if ("assigned".equals(dto.getReleaseType()) && !groupItems.isEmpty()) {
|
||||
Long itemReceiverId = groupItems.get(0).getReceiverId();
|
||||
if (itemReceiverId != null) {
|
||||
item.setReceiverId(itemReceiverId);
|
||||
User itemReceiver = userService.getUserById(itemReceiverId);
|
||||
if (itemReceiver != null && itemReceiver.getDeptId() != null) {
|
||||
item.setReceiverDeptId(itemReceiver.getDeptId());
|
||||
}
|
||||
log.info("子任务组 {} 已预先指定设计师: {}", groupNo, itemReceiverId);
|
||||
}
|
||||
}
|
||||
|
||||
// 关键:根据流水线模式和分组设置初始状态
|
||||
if ("sequential".equals(dto.getPipelineMode())) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user