| | |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.jetbrains.annotations.Nullable; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | } |
| | | //搜索条件,用户姓名 |
| | | if(StringUtils.isNotEmpty(orderPageList.getUserName())){ |
| | | List<AppUser> data = appUserClient.getAppUserByName(orderPageList.getUserName()).getData(); |
| | | List<AppUser> data = appUserClient.getAppUserByNameNoFilter(orderPageList.getUserName()).getData(); |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(collect)){ |
| | | return new PageInfo<>(); |
| | |
| | | } |
| | | //搜索条件,用户电话 |
| | | if(StringUtils.isNotEmpty(orderPageList.getPhone())){ |
| | | List<AppUser> data = appUserClient.getAppUserByPhone(orderPageList.getPhone()).getData(); |
| | | List<AppUser> data = appUserClient.getAppUserByPhoneNoFilter(orderPageList.getPhone()).getData(); |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(collect)){ |
| | | return new PageInfo<>(); |
| | | return new PageInfo<>(); |
| | | } |
| | | |
| | | if(null != orderPageList.getAppUserIds()){ |
| | | List<Long> appUserIds = orderPageList.getAppUserIds(); |
| | | if (!containsAny(appUserIds,collect)) { |
| | | return new PageInfo<>(); |
| | | } |
| | | appUserIds.addAll(collect); |
| | | orderPageList.setAppUserIds(appUserIds); |
| | | }else{ |
| | | orderPageList.setAppUserIds(collect); |
| | | } |
| | | } |
| | | if (null != orderPageList.getAppUserIds()){ |
| | | orderPageList.setAppUserIds(orderPageList.getAppUserIds().stream().distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | PageInfo<OrderPageListVo> pageInfo = new PageInfo<>(orderPageList.getPageCurr(), orderPageList.getPageSize()); |
| | | |
| | | List<OrderPageListVo> list = this.baseMapper.getOrderPageList(pageInfo, orderPageList); |
| | |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | /** |
| | | * 判断 list1 是否包含 list2 中的至少一个元素 |
| | | * |
| | | * @param list1 第一个列表 |
| | | * @param list2 第二个列表 |
| | | * @return 如果 list1 包含 list2 中的至少一个元素,返回 true;否则返回 false |
| | | */ |
| | | private boolean containsAny(List<Long> list1, List<Long> list2) { |
| | | // 将 list1 转换为 HashSet 以提高查询效率 |
| | | Set<Long> set1 = new HashSet<>(list1); |
| | | |
| | | // 遍历 list2,检查是否有元素存在于 set1 中 |
| | | for (Long element : list2) { |
| | | if (set1.contains(element)) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 如果没有找到共同元素,返回 false |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单操作 |