|
|
|
@ -447,19 +447,29 @@ public class EfcodeCpReserveServiceImpl implements IEfcodeCpReserveService { |
|
|
|
); |
|
|
|
log.info("[预约后置] planGroupId={}, 已同意数量={}, 最大联合数={}", reserve.getPlanGroupId(), approvedCount, maxUnionUnit); |
|
|
|
if (approvedCount >= maxUnionUnit) { |
|
|
|
// 达标:为该分组所有计划生成任务
|
|
|
|
// 达标:只生成1条任务,所有同组计划共享该task_id
|
|
|
|
List<EfcodeCpReserve> groupReserves = baseMapper.selectList( |
|
|
|
Wrappers.<EfcodeCpReserve>lambdaQuery() |
|
|
|
.eq(EfcodeCpReserve::getPlanGroupId, reserve.getPlanGroupId()) |
|
|
|
.eq(EfcodeCpReserve::getOpStatus, 1L) |
|
|
|
); |
|
|
|
String sharedTaskId = null; |
|
|
|
for (EfcodeCpReserve r : groupReserves) { |
|
|
|
EfcodeCpPlan plan = cpPlanMapper.selectById(r.getPlanId()); |
|
|
|
if (plan != null && StringUtils.isBlank(plan.getTaskId())) { |
|
|
|
cpTaskService.forceGenerateTask(plan); |
|
|
|
if (plan == null || StringUtils.isNotBlank(plan.getTaskId())) continue; |
|
|
|
if (sharedTaskId == null) { |
|
|
|
// 用第一条计划生成唯一一条任务
|
|
|
|
sharedTaskId = cpTaskService.forceGenerateTask(plan); |
|
|
|
} else { |
|
|
|
// 其余计划直接回写同一个task_id
|
|
|
|
EfcodeCpPlan planUpdate = new EfcodeCpPlan(); |
|
|
|
planUpdate.setId(plan.getId()); |
|
|
|
planUpdate.setTaskId(sharedTaskId); |
|
|
|
planUpdate.setReserveStatus(3L); |
|
|
|
cpPlanMapper.updateById(planUpdate); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("[预约后置] planGroupId={} 联合数量达标,已为{}条计划生成任务", reserve.getPlanGroupId(), groupReserves.size()); |
|
|
|
log.info("[预约后置] planGroupId={} 联合数量达标,生成1条任务taskId={},关联{}条计划", reserve.getPlanGroupId(), sharedTaskId, groupReserves.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|