| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | shopId = sysUser.getObjectId(); |
| | | } |
| | | List<Long> appUserIds = new ArrayList<>(); |
| | | //搜索条件,用户姓名 |
| | | if(StringUtils.isNotEmpty(refundPassListVo.getName())){ |
| | | List<AppUser> data = appUserClient.getAppUserByName(refundPassListVo.getName()).getData(); |
| | | //搜索条件,用户姓名和电话 |
| | | 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); |
| | | |
| | | 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(collect2); |
| | | } |
| | | //搜索条件,用户电话 |
| | | if(StringUtils.isNotEmpty(refundPassListVo.getPhone())){ |
| | | List<AppUser> data = appUserClient.getAppUserByPhone(refundPassListVo.getPhone()).getData(); |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | appUserIds.addAll(collect); |
| | | } |
| | | |
| | | PageInfo<OrderRefundPassList> pageInfo = new PageInfo(refundPassListVo.getPageCurr(), refundPassListVo.getPageSize()); |
| | | List<OrderRefundPassList> orderRefundPassList = this.baseMapper.getOrderRefundPassList(pageInfo, refundPassListVo.getCode(), appUserIds, shopId, refundPassListVo.getRefundMethod(), refundPassListVo.getStatus()); |
| | | for (OrderRefundPassList refundPassList : orderRefundPassList) { |
| | |
| | | } |
| | | 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); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | return R.fail("操作失败"); |
| | | } |
| | | refundPass.setStatus(2); |
| | | refundPass.setReceiveTime(LocalDateTime.now()); |
| | | //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分 |
| | | Order order = orderService.getById(refundPass.getOrderId()); |
| | | order.setOrderStatus(6); |