init
This commit is contained in:
@@ -56,9 +56,12 @@ public class AccountCashController extends BaseController {
|
||||
@SaCheckPermission("cai:accountCash:export")
|
||||
@Log(title = "用户提现记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(AccountCash bo, HttpServletResponse response) {
|
||||
List<AccountCash> list = accountCashService.list(Wrappers.lambdaQuery(bo));
|
||||
ExcelUtil.exportExcel(list, "用户提现记录", AccountCash.class, response);
|
||||
public void export(AccountCashAdminVo bo, HttpServletResponse response) {
|
||||
PageQuery query = new PageQuery();
|
||||
query.setPageSize(Integer.MAX_VALUE);
|
||||
query.setPageNum(1);
|
||||
List<AccountCashAdminVo> list = accountCashService.pageAdmin(query,bo).getRecords();
|
||||
ExcelUtil.exportExcel(list, "用户提现记录", AccountCashAdminVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.ruoyi.cai.pay.PayManager;
|
||||
import com.ruoyi.cai.service.RechargeOrderService;
|
||||
import com.ruoyi.cai.service.VipOrderService;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cai/test/pay")
|
||||
@Tag(name = "测试接口,正式环境取消")
|
||||
public class TestPayController {
|
||||
|
||||
@Autowired
|
||||
@@ -29,6 +32,7 @@ public class TestPayController {
|
||||
private PayManager payManager;
|
||||
|
||||
@GetMapping("/vip")
|
||||
@Operation(hidden = true)
|
||||
public R<Void> vip(Long memberPriceId, Long userId){
|
||||
AddVipOrderDto addVipOrderDto = new AddVipOrderDto();
|
||||
addVipOrderDto.setUserId(userId);
|
||||
@@ -39,6 +43,7 @@ public class TestPayController {
|
||||
}
|
||||
|
||||
@GetMapping("/recharge")
|
||||
@Operation(hidden = true)
|
||||
public R<Void> recharge(Long goodId, Long userId){
|
||||
AddRechargeOrderDto dto = new AddRechargeOrderDto();
|
||||
dto.setUserId(userId);
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
package com.ruoyi.cai.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.cai.enums.AccountCashStatusEnum;
|
||||
import com.ruoyi.cai.enums.IsAnchorEnum;
|
||||
import com.ruoyi.common.annotation.ExcelEnumFormat;
|
||||
import com.ruoyi.common.convert.ExcelEnumConvert;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -38,10 +46,13 @@ public class AccountCash implements Serializable {
|
||||
/**
|
||||
* 提现紫贝
|
||||
*/
|
||||
@ExcelProperty(value = "提现紫贝")
|
||||
private Long withdrawCoin;
|
||||
/**
|
||||
* 提现金额
|
||||
*/
|
||||
@ExcelProperty(value = "提现金额")
|
||||
@ContentFontStyle(color = Font.COLOR_RED)
|
||||
private BigDecimal cashMoney;
|
||||
/**
|
||||
* 真实提现金额
|
||||
@@ -54,18 +65,23 @@ public class AccountCash implements Serializable {
|
||||
/**
|
||||
* 银行名称
|
||||
*/
|
||||
@ExcelProperty(value = "银行名称")
|
||||
private String bank;
|
||||
/**
|
||||
* 账户名称
|
||||
*/
|
||||
@ExcelProperty(value = "账户名称")
|
||||
private String cardName;
|
||||
/**
|
||||
* 账户
|
||||
*/
|
||||
@ExcelProperty(value = "账户")
|
||||
private String cardAccount;
|
||||
/**
|
||||
* 1 申请 2 审核通过 3 审核不通过 4 提现取消
|
||||
*/
|
||||
@ExcelProperty(value = "状态",converter = ExcelEnumConvert.class)
|
||||
@ExcelEnumFormat(enumClass = AccountCashStatusEnum.class,codeField = "code",textField = "text")
|
||||
private Integer status;
|
||||
/**
|
||||
*
|
||||
@@ -92,7 +108,8 @@ public class AccountCash implements Serializable {
|
||||
*/
|
||||
private LocalDateTime exportTime;
|
||||
|
||||
|
||||
@ExcelProperty(value = "申请时间")
|
||||
@ColumnWidth(value = 20)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
package com.ruoyi.cai.dto.admin.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.cai.domain.AccountCash;
|
||||
import com.ruoyi.cai.enums.IsAnchorEnum;
|
||||
import com.ruoyi.common.annotation.ExcelEnumFormat;
|
||||
import com.ruoyi.common.annotation.Sensitive;
|
||||
import com.ruoyi.common.convert.ExcelEnumConvert;
|
||||
import com.ruoyi.common.enums.SensitiveStrategy;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AccountCashAdminVo extends AccountCash {
|
||||
/**
|
||||
* 用户号/ID号
|
||||
*/
|
||||
|
||||
@ExcelProperty(value = "蜜瓜号")
|
||||
private String usercode;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@ExcelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Sensitive(strategy = SensitiveStrategy.PHONE)
|
||||
@ExcelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
@@ -31,5 +38,7 @@ public class AccountCashAdminVo extends AccountCash {
|
||||
*/
|
||||
private Integer gender;
|
||||
private Integer age;
|
||||
@ExcelProperty(value = "主播",converter = ExcelEnumConvert.class)
|
||||
@ExcelEnumFormat(enumClass = IsAnchorEnum.class,codeField = "code",textField = "message")
|
||||
private Integer isAnchor;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public enum AccountBusinessEnum {
|
||||
/**
|
||||
* 提现
|
||||
*/
|
||||
WITHDRAW(AccountChangeEnum.WITHDRAW,null,null,null),
|
||||
// WITHDRAW(AccountChangeEnum.WITHDRAW,null,null,null),
|
||||
/**
|
||||
* 守护
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.cai.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 1 申请 2 审核通过 3 审核不通过 4 提现取消
|
||||
* <p>created on 2024/1/14 21:55</p>
|
||||
* @author duet
|
||||
*/
|
||||
@Getter
|
||||
public enum AccountCashStatusEnum {
|
||||
|
||||
READY(1,"申请中"),
|
||||
SUCCESS(2,"审核通过"),
|
||||
FAIL(3,"审核未通过"),
|
||||
CLOSE(4,"提现取消"),
|
||||
;
|
||||
private final Integer code;
|
||||
private final String text;
|
||||
|
||||
AccountCashStatusEnum(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.cai.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum IsAnchorEnum {
|
||||
YES(1,"是"),
|
||||
NO(0,"否"),
|
||||
;
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
IsAnchorEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,11 @@ public class AmqpConsumer {
|
||||
,containerFactory = "customContainerFactory")
|
||||
public void calculateSalesQueue(String message) {
|
||||
log.info("接受到到分销处理请求: message=" + message);
|
||||
consumeLogService.dealFenxiao(Long.valueOf(message));
|
||||
try {
|
||||
consumeLogService.dealFenxiao(Long.valueOf(message),true);
|
||||
}catch (Exception e){
|
||||
log.error("处理分销失败: message=" + message,e);
|
||||
}
|
||||
log.info("分销处理完成: message=" + message);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.cai.pay;
|
||||
|
||||
import com.ruoyi.cai.manager.ConsumerManager;
|
||||
import com.ruoyi.cai.service.RechargeOrderService;
|
||||
import com.ruoyi.cai.service.VipOrderService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -13,7 +14,7 @@ public class PayManager {
|
||||
@Autowired
|
||||
private VipOrderService vipOrderService;
|
||||
@Autowired
|
||||
private RechargeOrderService rechargeOrderService;
|
||||
private ConsumerManager consumerManager;
|
||||
|
||||
public void callBack(String orderNo){
|
||||
OrderTypeEnum orderTypeEnum = OrderNoUtil.getType(orderNo);
|
||||
@@ -26,7 +27,7 @@ public class PayManager {
|
||||
vipOrderService.orderSuccess(orderNo);
|
||||
break;
|
||||
case RECHARGE_ORDER_SUB:
|
||||
rechargeOrderService.orderSuccess(orderNo);
|
||||
consumerManager.rechargeOrderSuccess(orderNo);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.ruoyi.cai.domain.ConsumeLog;
|
||||
*/
|
||||
public interface ConsumeLogService extends IService<ConsumeLog> {
|
||||
|
||||
void dealFenxiao(Long id);
|
||||
void dealFenxiao(Long id,boolean system);
|
||||
|
||||
ConsumeLog calculateInitFenxiao(ConsumeLog consumeLog);
|
||||
}
|
||||
|
||||
@@ -181,13 +181,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
if(!incs){
|
||||
throw new ServiceException("需"+incomeCoin+caiProperties.getCoinName()+"才可提现");
|
||||
}
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountBusinessEnum.WITHDRAW.getSourceEnum(),incomeCoin,traceId);
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountChangeEnum.WITHDRAW,incomeCoin,traceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void recharge(ConsumeLog consumeLog){
|
||||
log.info("开始扣费 consumeLog={}", JSON.toJSONString(consumeLog));
|
||||
log.info("开始充值 consumeLog={}", JSON.toJSONString(consumeLog));
|
||||
Long userId = consumeLog.getSourceUserId();
|
||||
Long amount = consumeLog.getAmount();
|
||||
User user = userService.getById(userId);
|
||||
@@ -195,8 +195,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
if(account == null || user == null){
|
||||
throw new ServiceException("无效账号");
|
||||
}
|
||||
baseMapper.incsIncomeCoin(userId, amount);
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN,AccountBusinessEnum.RECHARGE.getOneEnum(),amount,consumeLog.getTraceId());
|
||||
baseMapper.incsCoin(userId, amount);
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN,AccountBusinessEnum.RECHARGE.getSourceEnum(),amount,consumeLog.getTraceId());
|
||||
// 获取分销的比例和用户
|
||||
consumeLogService.calculateInitFenxiao(consumeLog);
|
||||
consumeLogService.save(consumeLog);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.cai.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -11,6 +12,7 @@ import com.ruoyi.cai.mapper.ConsumeLogMapper;
|
||||
import com.ruoyi.cai.service.*;
|
||||
import com.ruoyi.cai.util.NumCaUtil;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
@@ -42,7 +44,7 @@ public class ConsumeLogServiceImpl extends ServiceImpl<ConsumeLogMapper, Consume
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void dealFenxiao(Long id){
|
||||
public void dealFenxiao(Long id,boolean system){
|
||||
ConsumeLog consumer = this.getById(id);
|
||||
if(consumer == null){
|
||||
return;
|
||||
@@ -63,13 +65,21 @@ public class ConsumeLogServiceImpl extends ServiceImpl<ConsumeLogMapper, Consume
|
||||
this.updateById(consumer);
|
||||
}
|
||||
}
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
String opName = "system";
|
||||
Long opId = null;
|
||||
if(!system){
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if(loginUser != null){
|
||||
opName = loginUser.getUsername();
|
||||
opId = loginUser.getUserId();
|
||||
}
|
||||
}
|
||||
// 在分销
|
||||
boolean update = this.update(Wrappers.lambdaUpdate(ConsumeLog.class)
|
||||
.eq(ConsumeLog::getId, id)
|
||||
.eq(ConsumeLog::getStatus, ConsumeLogStatus.READY.getCode())
|
||||
.set(ConsumeLog::getOpName, loginUser!=null?loginUser.getUsername():"system")
|
||||
.set(ConsumeLog::getOpId, loginUser!=null?loginUser.getUserId():"-1")
|
||||
.set(ConsumeLog::getOpName, opName)
|
||||
.set(ConsumeLog::getOpId, opId)
|
||||
.set(ConsumeLog::getStatus, ConsumeLogStatus.ALREADY.getCode()));
|
||||
if(!update){
|
||||
log.error("无需分销 consumer={}", JSON.toJSONString(consumer));
|
||||
@@ -78,7 +88,7 @@ public class ConsumeLogServiceImpl extends ServiceImpl<ConsumeLogMapper, Consume
|
||||
AccountBusinessEnum accountBusinessEnum = AccountBusinessEnum.getByName(consumer.getBusinessEnum());
|
||||
if(accountBusinessEnum == null){
|
||||
log.error("分销失败 BusinessEnum状态错误! consumerLog={}",JSON.toJSONString(consumer));
|
||||
return;
|
||||
throw new ServiceException("分销失败!请联系管理员排查问题!");
|
||||
}
|
||||
try {
|
||||
// 计算一级
|
||||
|
||||
@@ -111,6 +111,7 @@ public class GuardTotalServiceImpl extends ServiceImpl<GuardTotalMapper, GuardTo
|
||||
consumeLog.init(fromUser,toUser);
|
||||
consumeLog.setTraceId(tractId);
|
||||
consumeLog.setType(ConsumeLogType.GUARD.getCode());
|
||||
consumeLog.setBusinessEnum(AccountBusinessEnum.GUARD.name());
|
||||
consumeLog.setAmount(guardValue);
|
||||
consumeLog.setTargetRate(anchor.getGuardRate());
|
||||
consumeLog = accountService.decr(consumeLog, AccountBusinessEnum.GUARD);
|
||||
|
||||
@@ -114,6 +114,7 @@ public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper,Re
|
||||
consumeLog.init(user,null);
|
||||
consumeLog.setTraceId(traceId);
|
||||
consumeLog.setType(ConsumeLogType.RECHARGE.getCode());
|
||||
consumeLog.setBusinessEnum(AccountBusinessEnum.RECHARGE.name());
|
||||
consumeLog.setAmount(rechargeOrder.getRechargeCoin());
|
||||
accountService.recharge(consumeLog);
|
||||
ConsumeResp resp = new ConsumeResp();
|
||||
|
||||
@@ -76,6 +76,7 @@ public class UserGiftServiceImpl extends ServiceImpl<UserGiftMapper, UserGift> i
|
||||
consumeLog.init(fromUser,toUser);
|
||||
consumeLog.setTraceId(traceId);
|
||||
consumeLog.setType(ConsumeLogType.GIFT.getCode());
|
||||
consumeLog.setBusinessEnum(AccountBusinessEnum.GIFT.name());
|
||||
consumeLog.setAmount(giftAmount);
|
||||
consumeLog.setTargetRate(anchor.getGiftRate());
|
||||
consumeLog = accountService.decr(consumeLog, AccountBusinessEnum.GIFT);
|
||||
|
||||
@@ -22,7 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* VIP订单Service业务层处理
|
||||
@@ -152,13 +154,14 @@ public class VipOrderServiceImpl extends ServiceImpl<VipOrderMapper,VipOrder> im
|
||||
userMember.setMemberType(memberType);
|
||||
userMember.setExpire(expire);
|
||||
userMember.setLongs(longs);
|
||||
userMember.setExpireDate(createTime.plusDays(expire));
|
||||
LocalDate expireDate = createTime.plusDays(expire).plusDays(1).toLocalDate();
|
||||
userMember.setExpireDate(LocalDateTime.of(expireDate, LocalTime.MIN));
|
||||
userMember.setCreateTime(createTime);
|
||||
userMember.setMemberStatus(MemberStatusEnum.NORMAL.getCode());
|
||||
userMemberService.saveOrUpdate(userMember);
|
||||
return true;
|
||||
}
|
||||
if(longs == 1){ // 已经是永久会员还买? 傻逼
|
||||
if(userMember.getLongs() == 1){ // 已经是永久会员还买? 傻逼
|
||||
return true;
|
||||
}
|
||||
userMember.setCreateTime(createTime);
|
||||
|
||||
Reference in New Issue
Block a user