From 64f7ccb9ef8b5a0618e65cddc14b981c1f108ba3 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 04 十一月 2024 09:01:59 +0800 Subject: [PATCH] 代码提交 --- xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWalletRecordController.java | 45 +++++++++++++++++++++++++++++++++++++++------ 1 files changed, 39 insertions(+), 6 deletions(-) diff --git a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWalletRecordController.java b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWalletRecordController.java index 5c3be95..65268ac 100644 --- a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWalletRecordController.java +++ b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserWalletRecordController.java @@ -1,13 +1,17 @@ package com.xinquan.user.controller.client; +import com.alibaba.nacos.common.utils.UuidUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.xinquan.common.core.domain.R; import com.xinquan.common.core.utils.page.CollUtils; import com.xinquan.common.core.utils.page.PageDTO; import com.xinquan.common.core.web.domain.BaseModel; +import com.xinquan.common.security.service.TokenService; import com.xinquan.common.security.utils.SecurityUtils; +import com.xinquan.course.api.domain.Course; +import com.xinquan.course.api.feign.RemoteCourseService; import com.xinquan.order.api.domain.Order; import com.xinquan.order.api.feign.RemoteOrderService; import com.xinquan.system.api.domain.AppUser; @@ -16,6 +20,7 @@ import com.xinquan.system.api.domain.vo.InviteRankListVO; import com.xinquan.system.api.domain.vo.OrderDetailVO; import com.xinquan.system.api.domain.vo.OrderListVO; +import com.xinquan.system.api.model.LoginUser; import com.xinquan.user.api.domain.dto.UserBalanceDetailDTO; import com.xinquan.user.api.domain.dto.UserChildDTO; import com.xinquan.user.service.AppUserService; @@ -24,12 +29,14 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.expression.spel.ast.OpNE; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.List; import java.util.stream.Collectors; @@ -54,6 +61,15 @@ private AppUserWalletRecordService appUserWalletRecordService; @Resource private RemoteOrderService remoteOrderService; + @Resource + private RemoteCourseService remoteCourseService; + // 用户获得分佣收益 新增一条余额明细记录 + @PostMapping("/addBalanceRecord") + public R addBalanceRecord(@RequestBody AppUserWalletRecord appUserWalletRecord) { + appUserWalletRecordService.save(appUserWalletRecord); + return R.ok(); + } + @PostMapping("/childUserList") @ApiOperation(value = "用户详情-下级用户列表",tags = "管理后台-用户管理") public R<PageDTO<AppUser>> childUserList(@RequestBody UserChildDTO dto) { @@ -115,6 +131,8 @@ } return R.ok(PageDTO.of(page, OrderListVO.class)); } + @Autowired + private TokenService tokenService; /** * 爱心助力榜单-分页 * @@ -130,11 +148,14 @@ @ApiImplicitParam(value = "分页参数,每页数量", name = "pageSize", required = true, dataType = "Integer") }) public R<PageDTO<OrderListVO>> balanceList(Integer state,Integer pageCurr, Integer pageSize) { - Long userId = SecurityUtils.getUserId(); - if (userId==0)return R.tokenError("登录失效"); + LoginUser loginUser = tokenService.getLoginUser(); + if (loginUser==null){ + return R.tokenError("登录失效"); + } + Long userId = loginUser.getUserid(); LambdaQueryWrapper<AppUserWalletRecord> appUserWalletRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (state!=1){ - appUserWalletRecordLambdaQueryWrapper.eq(AppUserWalletRecord::getChangeType, state); + appUserWalletRecordLambdaQueryWrapper.eq(AppUserWalletRecord::getChangeType, state-1); } appUserWalletRecordLambdaQueryWrapper.eq(AppUserWalletRecord::getAppUserId, userId); appUserWalletRecordLambdaQueryWrapper.orderByDesc(BaseModel::getCreateTime); @@ -215,8 +236,11 @@ @ApiImplicitParam(name = "id", value = "id", dataType = "Long", required = true), }) public R<OrderDetailVO> balanceDetail(Long id) { - Long userId = SecurityUtils.getUserId(); - if (userId==0)return R.tokenError("登录失效"); + LoginUser loginUser = tokenService.getLoginUser(); + if (loginUser==null){ + return R.tokenError("登录失效"); + } + Long userId = loginUser.getUserid(); OrderDetailVO orderDetailVO = new OrderDetailVO(); AppUserWalletRecord byId = walletRecordService.getById(id); if (byId.getOrderId()!=null){ @@ -265,7 +289,16 @@ orderDetailVO.setChangeType(byId.getChangeType()); orderDetailVO.setPaymentTime(byId1.getUpdateTime()); return R.ok(new OrderDetailVO()); - + }else if (byId.getReason().contains("课程")){ + Order data = remoteOrderService.getOrderById(byId.getOrderId()).getData(); + if (data!=null){ + Course data1 = remoteCourseService.getCourseById(data.getBusinessId()).getData(); + orderDetailVO.setType("课程购买"); + orderDetailVO.setPayOrderNo(data.getPayOrderNo()); + orderDetailVO.setAmount(data.getRealPayAmount()); + orderDetailVO.setChangeType(byId.getChangeType()); + orderDetailVO.setPaymentTime(data.getPaymentTime()); + } } } return R.ok(orderDetailVO); -- Gitblit v1.7.1