| | |
| | | return 0; |
| | | } |
| | | |
| | | log.info("[转运单同步] 开始同步,范围: 最近{}天", daysAgo); |
| | | // log.info("[转运单同步] 开始同步,范围: 最近{}天", daysAgo); |
| | | int totalSuccessCount = 0; |
| | | int totalDays = daysAgo + 1; |
| | | |
| | |
| | | String dayEndStr = DateUtils.parseDateToStr("yyyy-MM-dd", dayStart) + " 23:59:59"; |
| | | |
| | | int dayIndex = totalDays - i; |
| | | log.info("[转运单同步] 处理天 {}/{}: {}", dayIndex, totalDays, dayStartStr); |
| | | // log.info("[转运单同步] 处理天 {}/{}: {}", dayIndex, totalDays, dayStartStr); |
| | | int daySuccessCount = syncSingleDayOrders(dayStartStr, dayEndStr); |
| | | totalSuccessCount += daySuccessCount; |
| | | log.info("[转运单同步] {} 完成,新增同步: {}条,累计: {}条", dayStartStr, daySuccessCount, totalSuccessCount); |
| | | // log.info("[转运单同步] {} 完成,新增同步: {}条,累计: {}条", dayStartStr, daySuccessCount, totalSuccessCount); |
| | | } |
| | | |
| | | log.info("[转运单同步] 全部完成,共新增同步 {}条", totalSuccessCount); |
| | | // log.info("[转运单同步] 全部完成,共新增同步 {}条", totalSuccessCount); |
| | | return totalSuccessCount; |
| | | |
| | | } catch (Exception e) { |
| | |
| | | int totalCount = transferOrders.size(); |
| | | int processedCount = 0; |
| | | |
| | | log.info("[转运单同步] {} 第{}页,获取{}.条数据,lastId={}", startDateStr, pageNum, totalCount, lastId); |
| | | // log.info("[转运单同步] {} 第{}页,获取{}.条数据,lastId={}", startDateStr, pageNum, totalCount, lastId); |
| | | |
| | | for (Map<String, Object> order : transferOrders) { |
| | | processedCount++; |
| | |
| | | } |
| | | } |
| | | |
| | | log.info("[转运单同步] {} 分页完成,共处理: {}条,新增同步: {}条", startDateStr, totalProcessed, successCount); |
| | | // log.info("[转运单同步] {} 分页完成,共处理: {}条,新增同步: {}条", startDateStr, totalProcessed, successCount); |
| | | } catch (Exception e) { |
| | | log.error("同步单天转运单数据异常: date={}", startDateStr, e); |
| | | } |
| | |
| | | // 1. 获取执行人列表 |
| | | List<TaskCreateVO.AssigneeInfo> assignees = queryAssignees(dispatchOrdID); |
| | | if (assignees.isEmpty()) { |
| | | log.info("旧系统同步转运单无执行人,taskId={}", taskId); |
| | | // log.info("旧系统同步转运单无执行人,taskId={}", taskId); |
| | | return; |
| | | } |
| | | |
| | |
| | | } |
| | | // 该用户已有通知记录,跳过 |
| | | if (existingUserIds.contains(assignee.getUserId())) { |
| | | log.info("用户已有通知记录,跳过创建,taskId={}, userId={}", taskId, assignee.getUserId()); |
| | | // log.info("用户已有通知记录,跳过创建,taskId={}, userId={}", taskId, assignee.getUserId()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | NotifyTask created = notifyTaskService.createNotifyTask(notifyTask); |
| | | if (created != null) { |
| | | notifyTasks.add(created); |
| | | log.info("创建通知任务成功,id={}, userId={}", created.getId(), user.getUserId()); |
| | | // log.info("创建通知任务成功,id={}, userId={}", created.getId(), user.getUserId()); |
| | | } |
| | | } |
| | | |
| | | // 6. 分发通知任务 |
| | | if (!notifyTasks.isEmpty()) { |
| | | int successCount = notifyDispatchService.dispatchNotifies(notifyTasks); |
| | | log.info("旧系统同步转运单通知分发完成,taskId={}, 分发数量={}, 成功数量={}", |
| | | taskId, notifyTasks.size(), successCount); |
| | | } else { |
| | | log.info("旧系统同步转运单无需新增通知,taskId={}", taskId); |
| | | // log.info("旧系统同步转运单通知分发完成,taskId={}, 分发数量={}, 成功数量={}", |
| | | // taskId, notifyTasks.size(), successCount); |
| | | } |
| | | // else { |
| | | // log.info("旧系统同步转运单无需新增通知,taskId={}", taskId); |
| | | // } |
| | | |
| | | // 5. 同时保留原有的微信通知服务(兼容) |
| | | // List<Long> userIds = new ArrayList<>(); |