| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | 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) { |
| | |
| | | } |
| | | return R.ok(PageDTO.of(page, OrderListVO.class)); |
| | | } |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | /** |
| | | * 爱心助力榜单-分页 |
| | | * |
| | |
| | | @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); |
| | |
| | | @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){ |
| | |
| | | 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); |