init
This commit is contained in:
@@ -9,10 +9,12 @@ import com.ruoyi.cai.dto.app.query.AccountAliBankCardRes;
|
|||||||
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
||||||
import com.ruoyi.cai.dto.app.vo.AccountCashVo;
|
import com.ruoyi.cai.dto.app.vo.AccountCashVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.RechargeOrderVo;
|
import com.ruoyi.cai.dto.app.vo.RechargeOrderVo;
|
||||||
|
import com.ruoyi.cai.dto.app.vo.account.AccountDetailsAppVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.user.UserAccountVo;
|
import com.ruoyi.cai.dto.app.vo.user.UserAccountVo;
|
||||||
import com.ruoyi.cai.manager.CurrentUserManager;
|
import com.ruoyi.cai.manager.CurrentUserManager;
|
||||||
import com.ruoyi.cai.pay.PayStatusEnum;
|
import com.ruoyi.cai.pay.PayStatusEnum;
|
||||||
import com.ruoyi.cai.service.AccountCashService;
|
import com.ruoyi.cai.service.AccountCashService;
|
||||||
|
import com.ruoyi.cai.service.AccountChangeLogService;
|
||||||
import com.ruoyi.cai.service.RechargeOrderService;
|
import com.ruoyi.cai.service.RechargeOrderService;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
@@ -21,6 +23,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
import com.ruoyi.common.utils.BeanConvertUtil;
|
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -38,6 +41,8 @@ public class WalletController {
|
|||||||
private AccountCashService accountCashService;
|
private AccountCashService accountCashService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RechargeOrderService rechargeOrderService;
|
private RechargeOrderService rechargeOrderService;
|
||||||
|
@Autowired
|
||||||
|
private AccountChangeLogService accountChangeLogService;
|
||||||
|
|
||||||
@GetMapping("/account")
|
@GetMapping("/account")
|
||||||
@Operation(summary = "快速获取当前用户账号余额信息")
|
@Operation(summary = "快速获取当前用户账号余额信息")
|
||||||
@@ -46,6 +51,16 @@ public class WalletController {
|
|||||||
return R.ok(currentUserManager.currentAccount());
|
return R.ok(currentUserManager.currentAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/accountDetail/page")
|
||||||
|
@Operation(summary = "账户明细-分页")
|
||||||
|
@Log(title = "账户明细", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<List<AccountDetailsAppVo>> accountDetail(PageQuery query,
|
||||||
|
@Parameter(description = "类型 0-普通会员 1-超级会员") Integer cateId){
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
List<AccountDetailsAppVo> res = accountChangeLogService.pageApp(query,cateId,userId);
|
||||||
|
return R.ok(res);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/aliInfo")
|
@GetMapping("/aliInfo")
|
||||||
@Operation(summary = "获取绑定支付宝信息")
|
@Operation(summary = "获取绑定支付宝信息")
|
||||||
@Log(title = "获取绑定支付宝信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "获取绑定支付宝信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ import lombok.Data;
|
|||||||
public class ConsumeResp {
|
public class ConsumeResp {
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Long consumeLogId;
|
private Long consumeLogId;
|
||||||
|
private Long traceId;
|
||||||
private boolean success;
|
private boolean success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ public class VisitorQuery {
|
|||||||
@Schema(description = "类型 1=查询我的足迹 2=查询我的访客")
|
@Schema(description = "类型 1=查询我的足迹 2=查询我的访客")
|
||||||
private Integer type = 1;
|
private Integer type = 1;
|
||||||
|
|
||||||
@Schema(description = "用户ID",accessMode = Schema.AccessMode.READ_WRITE)
|
@Schema(description = "用户ID", hidden = true)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.cai.dto.app.vo.account;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "账户明细说明")
|
||||||
|
public class AccountDetailsAppVo {
|
||||||
|
@Schema(description = "账户明细说明")
|
||||||
|
private String message;
|
||||||
|
@Schema(description = "变化值,有正负值")
|
||||||
|
private Long changeValue;
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
/**
|
||||||
|
* 账户类型 1-余额 2-收益
|
||||||
|
*/
|
||||||
|
@Schema(description = "账户类型 1-余额 2-收益")
|
||||||
|
private Integer accountType;
|
||||||
|
/**
|
||||||
|
* 类别
|
||||||
|
*/
|
||||||
|
@Schema(description = "类别ID")
|
||||||
|
private Integer cateId;
|
||||||
|
@Schema(description = "显示图片")
|
||||||
|
private String img;
|
||||||
|
}
|
||||||
@@ -81,16 +81,16 @@ public class AwardManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||||
if(userInfo == null || BooleanUtils.isNotTrue(userInfo.getFastPay())){
|
if(userInfo == null || BooleanUtils.isNotFalse(userInfo.getFastPay())){
|
||||||
log.warn("首充奖励领取失败 用户已领取 userId={}",userId);
|
log.warn("首充奖励领取失败 用户已领取 85 userId={}",userId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean update = userInfoService.update(Wrappers.lambdaUpdate(UserInfo.class)
|
boolean update = userInfoService.update(Wrappers.lambdaUpdate(UserInfo.class)
|
||||||
.eq(UserInfo::getId, userInfo.getUserId())
|
.eq(UserInfo::getId, userInfo.getId())
|
||||||
.eq(UserInfo::getFastPay, false)
|
.eq(UserInfo::getFastPay, false)
|
||||||
.set(UserInfo::getFastPay, true));
|
.set(UserInfo::getFastPay, true));
|
||||||
if(!update){
|
if(!update){
|
||||||
log.warn("首充奖励领取失败 用户已领取 userId={}",userId);
|
log.warn("首充奖励领取失败 用户已领取 93 userId={}",userId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
accountMapper.incsIncomeCoin(userId,price);
|
accountMapper.incsIncomeCoin(userId,price);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class PayManager {
|
|||||||
case RECHARGE_ORDER_SUB:
|
case RECHARGE_ORDER_SUB:
|
||||||
ConsumeResp resp = consumerManager.rechargeOrderSuccess(orderNo);
|
ConsumeResp resp = consumerManager.rechargeOrderSuccess(orderNo);
|
||||||
if(resp.isSuccess()){
|
if(resp.isSuccess()){
|
||||||
awardManager.giveFastPayAsync(resp.getUserId(), resp.getConsumeLogId());
|
awardManager.giveFastPayAsync(resp.getUserId(), resp.getTraceId());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.cai.domain.AccountChangeLog;
|
import com.ruoyi.cai.domain.AccountChangeLog;
|
||||||
import com.ruoyi.cai.domain.Gift;
|
import com.ruoyi.cai.domain.Gift;
|
||||||
|
import com.ruoyi.cai.dto.app.vo.account.AccountDetailsAppVo;
|
||||||
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户明细Service接口
|
* 账户明细Service接口
|
||||||
*
|
*
|
||||||
@@ -28,4 +31,6 @@ public interface AccountChangeLogService extends IService<AccountChangeLog> {
|
|||||||
AccountChangeLog saveLogAdmin(Long userId, String usercode, AccountChangeCodeEnum change, Long price, Long traceId);
|
AccountChangeLog saveLogAdmin(Long userId, String usercode, AccountChangeCodeEnum change, Long price, Long traceId);
|
||||||
|
|
||||||
Page<AccountChangeLog> pageAdmin(PageQuery pageQuery, AccountChangeLog bo);
|
Page<AccountChangeLog> pageAdmin(PageQuery pageQuery, AccountChangeLog bo);
|
||||||
|
|
||||||
|
List<AccountDetailsAppVo> pageApp(PageQuery query, Integer cateId, Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.ruoyi.cai.domain.AccountChangeLog;
|
import com.ruoyi.cai.domain.AccountChangeLog;
|
||||||
import com.ruoyi.cai.domain.Gift;
|
import com.ruoyi.cai.domain.Gift;
|
||||||
import com.ruoyi.cai.domain.User;
|
import com.ruoyi.cai.domain.User;
|
||||||
|
import com.ruoyi.cai.dto.app.vo.account.AccountDetailsAppVo;
|
||||||
import com.ruoyi.cai.enums.account.AccountCateEnum;
|
import com.ruoyi.cai.enums.account.AccountCateEnum;
|
||||||
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||||
import com.ruoyi.cai.mapper.AccountChangeLogMapper;
|
import com.ruoyi.cai.mapper.AccountChangeLogMapper;
|
||||||
@@ -15,6 +16,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -131,5 +133,62 @@ public class AccountChangeLogServiceImpl extends ServiceImpl<AccountChangeLogMap
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AccountDetailsAppVo> pageApp(PageQuery query, Integer cateId, Long userId) {
|
||||||
|
Page<AccountChangeLog> page = this.page(query.build(),
|
||||||
|
Wrappers.lambdaQuery(AccountChangeLog.class)
|
||||||
|
.eq(AccountChangeLog::getUserId,userId)
|
||||||
|
.eq(cateId != null, AccountChangeLog::getCateId,cateId)
|
||||||
|
.orderByDesc(AccountChangeLog::getCreateTime));
|
||||||
|
List<AccountDetailsAppVo> res = new ArrayList<>();
|
||||||
|
List<AccountChangeLog> records = page.getRecords();
|
||||||
|
if(records.isEmpty()){
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
Set<Long> userIds = records.stream().map(AccountChangeLog::getTarUserId).collect(Collectors.toSet());
|
||||||
|
List<User> users = userService.listByIds(userIds);
|
||||||
|
Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||||
|
for (AccountChangeLog record : records) {
|
||||||
|
AccountDetailsAppVo vo = new AccountDetailsAppVo();
|
||||||
|
vo.setChangeValue(record.getChangeValue());
|
||||||
|
vo.setCreateTime(record.getCreateTime());
|
||||||
|
vo.setAccountType(record.getAccountType());
|
||||||
|
vo.setCateId(record.getCateId());
|
||||||
|
User user = userMap.get(record.getTarUserId());
|
||||||
|
if(user != null){
|
||||||
|
AccountChangeCodeEnum changeEnum = AccountChangeCodeEnum.getByCode(record.getChangeType());
|
||||||
|
if(changeEnum != null){
|
||||||
|
Boolean in = changeEnum.getIn();
|
||||||
|
if(in == null){
|
||||||
|
vo.setMessage(record.getCateAdminName());
|
||||||
|
}else{
|
||||||
|
String format = String.format("%s%s%s",
|
||||||
|
record.getCateAdminName(),
|
||||||
|
in?"来自":"给",
|
||||||
|
user.getNickname());
|
||||||
|
vo.setMessage(format);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
vo.setMessage(record.getCateAdminName());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
vo.setMessage(record.getCateAdminName());
|
||||||
|
}
|
||||||
|
if(AccountCateEnum.IM.getCode().equals(record.getCateId())
|
||||||
|
|| AccountCateEnum.VIDEO.getCode().equals(record.getCateId())
|
||||||
|
|| AccountCateEnum.GUARD.getCode().equals(record.getCateId())
|
||||||
|
|| AccountCateEnum.SYSTEM.getCode().equals(record.getCateId())
|
||||||
|
|| AccountCateEnum.UNION.getCode().equals(record.getCateId())){
|
||||||
|
if(record.getTarUserId() != null){
|
||||||
|
if(user != null){
|
||||||
|
vo.setImg(user.getAvatar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.add(vo);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper,Re
|
|||||||
resp.setSuccess(true);
|
resp.setSuccess(true);
|
||||||
resp.setConsumeLogId(consumeLog.getId());
|
resp.setConsumeLogId(consumeLog.getId());
|
||||||
resp.setUserId(user.getId());
|
resp.setUserId(user.getId());
|
||||||
|
resp.setTraceId(traceId);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user