Просмотр исходного кода

Merge remote-tracking branch 'origin/ScrmStores' into ScrmStores

yjwang 1 день назад
Родитель
Сommit
b38af44850

+ 1 - 1
fs-admin/src/main/java/com/fs/FSApplication.java

@@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 @Transactional
 @EnableAsync
-@EnableScheduling
+//@EnableScheduling
 public class FSApplication
 {
     public static void main(String[] args)

+ 9 - 2
fs-service/src/main/java/com/fs/hospital580/service/impl/Hospital580ScrmServiceImpl.java

@@ -136,12 +136,19 @@ public class Hospital580ScrmServiceImpl extends ServiceImpl<Hospital580ScrmMappe
             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 -> !approvedMedicineIds.contains(String.valueOf(entity.getProductId())))
                 .map(Hospital580ProductPushScrmEntity::getProductId)
                 .collect(Collectors.toList());
+        productIdsToSync.addAll(failedResyncIds);
 
         if (productIdsToSync.isEmpty()) {
             return "没有需要同步的商品(已过滤掉非失败状态及580已审核通过的商品)";