| | |
| | | // if (keywordTasks.stream().allMatch(task -> |
| | | // "completed".equals(task.getStatus()) || "false".equals(task.getStatus()) || "canceled".equals(task.getStatus()) |
| | | // )) { |
| | | keyword.setStatus("canceled"); |
| | | keyword.setStatus("completed"); |
| | | keywordService.updateById(keyword); |
| | | // log.info("关键词 {} 所有任务已完成,更新状态为 completed", keywordId); |
| | | // } |
| | | //更新提问词状态为取消 |
| | | |
| | | questionService.update(new LambdaUpdateWrapper<Question>().eq(Question::getKeyword_id, keywordId).set(Question::getStatus, "canceled")); |
| | | questionService.update(new LambdaUpdateWrapper<Question>().eq(Question::getKeyword_id, keywordId).isNull(Question::getResponse).set(Question::getStatus, "canceled")); |
| | | |
| | | // 更新订单状态 |
| | | String orderId = keyword.getOrder_id(); |
| | |
| | | System.out.println("订单[" + orderId + "]下无关键词,跳过状态更新"); |
| | | return; |
| | | } |
| | | boolean allValid2 = orderKeywords.stream() |
| | | .allMatch(k -> "completed".equals(k.getStatus()) || "false".equals(k.getStatus()) || "canceled".equals(k.getStatus())); |
| | | if (allValid2) { |
| | | Orders orders = orderService.getById(orderId); |
| | | if (orders != null) { |
| | | orders.setStatus(1); // 假设Orders有Integer类型的status字段 |
| | | orderService.updateById(orders); |
| | | System.out.println("订单[" + orderId + "]所有关键词采集完成或者取消,已更新状态为1"); |
| | | } else { |
| | | System.out.println("未找到订单[" + orderId + "],无法更新状态"); |
| | | } |
| | | } |
| | | // 3. 检查所有关键词的状态是否均为 completed 或 false |
| | | boolean allValid = orderKeywords.stream() |
| | | .allMatch(k -> "completed".equals(k.getStatus()) || "false".equals(k.getStatus())); |
| | |
| | | System.out.println("未找到订单[" + orderId + "],无法更新状态"); |
| | | } |
| | | } |
| | | boolean allValid2 = orderKeywords.stream() |
| | | .allMatch(k -> "completed".equals(k.getStatus()) || "false".equals(k.getStatus()) || "canceled".equals(k.getStatus())); |
| | | if (allValid) { |
| | | Orders orders = orderService.getById(orderId); |
| | | if (orders != null) { |
| | | orders.setStatus(1); // 假设Orders有Integer类型的status字段 |
| | | orderService.updateById(orders); |
| | | System.out.println("订单[" + orderId + "]所有关键词采集完成或者取消,已更新状态为1"); |
| | | } else { |
| | | System.out.println("未找到订单[" + orderId + "],无法更新状态"); |
| | | } |
| | | } |
| | | |
| | | |
| | | Orders orders = orderService.getById(keyword.getOrder_id()); |
| | | |