From 8ffeb751b3a694e8d1cb6a21bec855f6c49b31b6 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期五, 07 二月 2025 15:38:46 +0800
Subject: [PATCH] 修改物流信息导入模板

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java |   55 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
index f831e2c..eb3323e 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -31,14 +31,14 @@
 import com.ruoyi.system.api.feignClient.SysUserClient;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -130,23 +130,30 @@
 			shopId = sysUser.getObjectId();
 		}
 		List<Long> appUserIds = new ArrayList<>();
-		//搜索条件,用户姓名
-		if(StringUtils.isNotEmpty(refundPassListVo.getUserName())){
+		//搜索条件,用户姓名和电话
+		if(StringUtils.isNotEmpty(refundPassListVo.getUserName()) || StringUtils.isNotEmpty(refundPassListVo.getPhone())){
 			List<AppUser> data = appUserClient.getAppUserByName(refundPassListVo.getUserName()).getData();
 			List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList());
 			if (collect.isEmpty()){
 				appUserIds.add(-1L);
 			}
 			appUserIds.addAll(collect);
-		}
-		//搜索条件,用户电话
-		if(StringUtils.isNotEmpty(refundPassListVo.getPhone())){
-			List<AppUser> data = appUserClient.getAppUserByPhone(refundPassListVo.getPhone()).getData();
-			List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList());
-			if (collect.isEmpty()){
+
+			List<AppUser> data2 = appUserClient.getAppUserByPhone(refundPassListVo.getPhone()).getData();
+			List<Long> collect2 = data2.stream().map(AppUser::getId).collect(Collectors.toList());
+			if (!CollectionUtils.isEmpty(data)){
+				for (AppUser datum : data) {
+					for (AppUser appUser : data2) {
+						if (!datum.getId().equals(appUser.getId())){
+							collect2.remove(appUser.getId());
+						}
+					}
+				}
+			}
+			if (collect2.isEmpty()){
 				appUserIds.add(-1L);
 			}
-			appUserIds.addAll(collect);
+			appUserIds.addAll(collect2);
 		}
 
 		PageInfo<OrderRefundPassList> pageInfo = new PageInfo(refundPassListVo.getPageCurr(), refundPassListVo.getPageSize());
@@ -160,6 +167,30 @@
 		}
 		return pageInfo.setRecords(orderRefundPassList);
 	}
+
+//	public void processAppUserIds(List<Long> appUserIds , String searchKey, Function<String, R<List<AppUser>>> userSearchFunction){
+//		if (StringUtils.isNotEmpty(searchKey)) {
+//			List<Long> userIds = Optional.ofNullable(userSearchFunction.apply(searchKey).getData())
+//					.orElse(Collections.emptyList())
+//					.stream()
+//					.map(AppUser::getId)
+//					.collect(Collectors.toList());
+//
+//			if (CollectionUtils.isEmpty(userIds)) {
+//				return;
+//			}
+//
+//			List<Long> existingUserIds = orderPageList.getAppUserIds();
+//			if (existingUserIds != null) {
+//				if (!containsAny(existingUserIds, userIds)) {
+//					return;
+//				}
+//				existingUserIds.addAll(userIds);
+//			} else {
+//				orderPageList.setAppUserIds(userIds);
+//			}
+//		}
+//	}
 	
 	
 	/**

--
Gitblit v1.7.1