| | |
| | | import com.ruoyi.account.util.payment.PaymentUtil; |
| | | import com.ruoyi.account.util.payment.model.UniPayCallbackResult; |
| | | import com.ruoyi.account.util.payment.model.UniPayResult; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.WalletVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | |
| | | // 将最后一天转换为 LocalDateTime,并设置为当天的最后一秒 (23:59:59.999) |
| | | endTime = lastDayOfMonth.atTime(LocalTime.MAX); |
| | | } |
| | | |
| | | Page<BalanceChangeRecordCopy> page = balanceChangeRecordCopyService.page(Page.of(pageCurr, pageSize), new LambdaQueryWrapper<BalanceChangeRecordCopy>() |
| | | .eq(changeType != null, BalanceChangeRecordCopy::getChangeType, changeType) |
| | | .between(startTime != null, BalanceChangeRecordCopy::getCreateTime, startTime, endTime) |
| | | .eq(BalanceChangeRecordCopy::getAppUserId, userId).orderByDesc(BalanceChangeRecordCopy::getCreateTime)); |
| | | |
| | | List<BalanceChangeRecordCopy> list = page.getRecords(); |
| | | |
| | | List<Long> orderIds = list.stream().map(BalanceChangeRecordCopy::getOrderId).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(orderIds)){ |
| | | R<List<Order>> r = remoteOrderGoodsClient.getOrderListByIds(orderIds); |
| | | if (!R.isSuccess(r)){ |
| | | return R.fail(r.getMsg()); |
| | | } |
| | | List<Order> orderList = r.getData(); |
| | | list.forEach(bc -> { |
| | | orderList.stream().filter(o -> o.getId().equals(bc.getOrderId())).findFirst().ifPresent(o -> { |
| | | Long appUserId = o.getAppUserId(); |
| | | AppUser appUser = appUserService.getById(appUserId); |
| | | if(null != appUser){ |
| | | bc.setUserName(appUser.getName()); |
| | | bc.setAmount(o.getPaymentAmount()); |
| | | } |
| | | }); |
| | | |
| | | BigDecimal beforeAmount = bc.getBeforeAmount(); |
| | | BigDecimal afterAmount = bc.getAfterAmount(); |
| | | if (beforeAmount.compareTo(afterAmount) > 0){ |
| | | bc.setFlag(2); |
| | | }else { |
| | | bc.setFlag(1); |
| | | } |
| | | }); |
| | | } |
| | | return R.ok(page); |
| | | Page<BalanceChangeRecordCopy> pageInfo = new Page<>(pageCurr, pageSize); |
| | | IPage<BalanceChangeRecordCopy> change = balanceChangeRecordService.change(pageInfo, changeType, startTime, endTime, userId); |
| | | return R.ok(change); |
| | | } |
| | | |
| | | /** |