|
@@ -136,12 +136,19 @@ public class Hospital580ScrmServiceImpl extends ServiceImpl<Hospital580ScrmMappe
|
|
|
log.info("已更新{}条580审核通过但本地标记为失败的推送记录为成功", idsToUpdate.size());
|
|
log.info("已更新{}条580审核通过但本地标记为失败的推送记录为成功", idsToUpdate.size());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //过滤掉同步状态不为2的商品,只保留push_status=2且580未审核通过的商品进行重新同步
|
|
|
|
|
- List<Long> productIdsToSync = latestPushMap.values().stream()
|
|
|
|
|
|
|
+ // 1. 从未推送过的商品(未同步):latestPushMap 中无记录,直接加入同步列表,不参与过滤
|
|
|
|
|
+ // 这类商品580审核接口必然查不到数据,无需也不能过滤
|
|
|
|
|
+ List<Long> productIdsToSync = productIdList.stream()
|
|
|
|
|
+ .filter(pid -> !latestPushMap.containsKey(pid))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 推送失败(push_status=2)且580未审核通过的商品,重新同步
|
|
|
|
|
+ List<Long> failedResyncIds = latestPushMap.values().stream()
|
|
|
.filter(entity -> entity.getPushStatus() != null && entity.getPushStatus() == 2)
|
|
.filter(entity -> entity.getPushStatus() != null && entity.getPushStatus() == 2)
|
|
|
.filter(entity -> !approvedMedicineIds.contains(String.valueOf(entity.getProductId())))
|
|
.filter(entity -> !approvedMedicineIds.contains(String.valueOf(entity.getProductId())))
|
|
|
.map(Hospital580ProductPushScrmEntity::getProductId)
|
|
.map(Hospital580ProductPushScrmEntity::getProductId)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
+ productIdsToSync.addAll(failedResyncIds);
|
|
|
|
|
|
|
|
if (productIdsToSync.isEmpty()) {
|
|
if (productIdsToSync.isEmpty()) {
|
|
|
return "没有需要同步的商品(已过滤掉非失败状态及580已审核通过的商品)";
|
|
return "没有需要同步的商品(已过滤掉非失败状态及580已审核通过的商品)";
|