Compare commits
7 Commits
fca80acccb
...
447cd262ad
Author | SHA1 | Date |
---|---|---|
|
447cd262ad | |
|
0f7743abb1 | |
|
ccd4372a68 | |
|
7150bcf495 | |
|
196ba38b15 | |
|
0d29d79af6 | |
|
43f11e5db2 |
|
@ -93,16 +93,7 @@ public class AliPayController extends BaseController {
|
||||||
String state = ShareCodeUtils.idToCode(SecurityUtils.getUserId()); // 防止CSRF攻击
|
String state = ShareCodeUtils.idToCode(SecurityUtils.getUserId()); // 防止CSRF攻击
|
||||||
|
|
||||||
String encodedRedirectUri = URLEncoder.encode(bindUrl, "UTF-8");
|
String encodedRedirectUri = URLEncoder.encode(bindUrl, "UTF-8");
|
||||||
// 线上
|
String authUrl = String.format(aliConfig.getOauthUrl(),appId, scope, encodedRedirectUri, state);
|
||||||
// String authUrl = String.format(
|
|
||||||
// "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=%s&scope=%s&redirect_uri=%s&state=%s",
|
|
||||||
// appId, scope, encodedRedirectUri, state
|
|
||||||
// );
|
|
||||||
// 沙箱
|
|
||||||
String authUrl = String.format(
|
|
||||||
"https://openauth-sandbox.dl.alipaydev.com/oauth2/publicAppAuthorize.htm?app_id=%s&scope=%s&redirect_uri=%s&state=%s",
|
|
||||||
appId, scope, encodedRedirectUri, state
|
|
||||||
);
|
|
||||||
|
|
||||||
// QrCodeUtil.generate(authUrl, 300, 300, "png", response.getOutputStream());
|
// QrCodeUtil.generate(authUrl, 300, 300, "png", response.getOutputStream());
|
||||||
return R.ok(authUrl, "成功");
|
return R.ok(authUrl, "成功");
|
||||||
|
@ -168,7 +159,7 @@ public class AliPayController extends BaseController {
|
||||||
|
|
||||||
if ("member".equalsIgnoreCase(type)) {
|
if ("member".equalsIgnoreCase(type)) {
|
||||||
if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) {
|
if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"商品id不能为空");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "商品id不能为空");
|
||||||
}
|
}
|
||||||
payVo = aliPayService.memberPay(orderTradeDto);
|
payVo = aliPayService.memberPay(orderTradeDto);
|
||||||
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
||||||
|
@ -178,12 +169,12 @@ public class AliPayController extends BaseController {
|
||||||
} else if ("wallet".equalsIgnoreCase(type)) {
|
} else if ("wallet".equalsIgnoreCase(type)) {
|
||||||
// 充值金额只能是整数
|
// 充值金额只能是整数
|
||||||
if (orderTradeDto.getAmount() % 1 != 0) {
|
if (orderTradeDto.getAmount() % 1 != 0) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"充值金额只能是整数");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "充值金额只能是整数");
|
||||||
}
|
}
|
||||||
payVo = aliPayService.walletPay(orderTradeDto.getAmount());
|
payVo = aliPayService.walletPay(orderTradeDto.getAmount());
|
||||||
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
||||||
} else {
|
} else {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"订单类型错误");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "订单类型错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
return R.ok(payVo);
|
return R.ok(payVo);
|
||||||
|
@ -207,15 +198,15 @@ public class AliPayController extends BaseController {
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
if (Objects.isNull(sysUserPayAccount)) {
|
if (Objects.isNull(sysUserPayAccount)) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请先绑定支付宝");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请先绑定支付宝");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Double.parseDouble(amount) < 0.1) {
|
if (Double.parseDouble(amount) < 0.1) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提现金额最小为0.1");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "提现金额最小为0.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
return aliPayService.fetch(amount.toString());
|
return aliPayService.fetch(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,10 @@ mall:
|
||||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||||
# 绑定回调
|
# 绑定回调
|
||||||
bindUrl: http://113.45.190.154:8080/ali/pay/callback
|
bindUrl: http://113.45.190.154:8080/ali/pay/callback
|
||||||
|
# 参与方的标识类型,目前支持如下类型: 1、ALIPAY_USER_ID 支付宝的会员ID 2、ALIPAY_LOGON_ID:支付宝登录号,支持邮箱和手机号格式 3、ALIPAY_OPEN_ID:支付宝openid
|
||||||
|
identityType: ALIPAY_USER_ID
|
||||||
|
# 授权url
|
||||||
|
oauthUrl: https://openauth-sandbox.dl.alipaydev.com/oauth2/publicAppAuthorize.htm?app_id=%s&scope=%s&redirect_uri=%s&state=%s
|
||||||
|
|
||||||
huawei:
|
huawei:
|
||||||
obs:
|
obs:
|
||||||
|
|
|
@ -148,6 +148,10 @@ mall:
|
||||||
gatewayUrl: https://openapi.alipay.com/gateway.do
|
gatewayUrl: https://openapi.alipay.com/gateway.do
|
||||||
# 绑定回调
|
# 绑定回调
|
||||||
bindUrl: https://36072a51.r27.cpolar.top/ali/pay/callback
|
bindUrl: https://36072a51.r27.cpolar.top/ali/pay/callback
|
||||||
|
# 参与方的标识类型,目前支持如下类型: 1、ALIPAY_USER_ID 支付宝的会员ID 2、ALIPAY_LOGON_ID:支付宝登录号,支持邮箱和手机号格式 3、ALIPAY_OPEN_ID:支付宝openid
|
||||||
|
identityType: ALIPAY_OPEN_ID
|
||||||
|
# 授权url
|
||||||
|
oauthUrl: https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=%s&scope=%s&redirect_uri=%s&state=%s
|
||||||
|
|
||||||
huawei:
|
huawei:
|
||||||
obs:
|
obs:
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.mcwl.common.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.pay.domain
|
|
||||||
* @Filename:PaymentStatus
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/3 17:24
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public enum CommissionRationEnum {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 佣金配给邀请者用户
|
|
||||||
*/
|
|
||||||
COMMISSION_RATION_INVITER_USER("CommissionRationInviterUser"),
|
|
||||||
/**
|
|
||||||
* 佣金配给商家用户
|
|
||||||
*/
|
|
||||||
COMMISSION_RATION_MERCHANT("CommissionRationMerchant");
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
}
|
|
|
@ -2,11 +2,13 @@ package com.mcwl.myInvitation.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.mcwl.common.core.redis.RedisCache;
|
||||||
import com.mcwl.myInvitation.domain.CommissionRatio;
|
import com.mcwl.myInvitation.domain.CommissionRatio;
|
||||||
import com.mcwl.myInvitation.domain.vo.CommissionRatioVo;
|
import com.mcwl.myInvitation.domain.vo.CommissionRatioVo;
|
||||||
import com.mcwl.myInvitation.mapper.CommissionRatioMapper;
|
import com.mcwl.myInvitation.mapper.CommissionRatioMapper;
|
||||||
import com.mcwl.myInvitation.service.CommissionRatioService;
|
import com.mcwl.myInvitation.service.CommissionRatioService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -20,6 +22,8 @@ import java.util.Objects;
|
||||||
public class CommissionRatioServiceImpl extends ServiceImpl<CommissionRatioMapper, CommissionRatio> implements CommissionRatioService {
|
public class CommissionRatioServiceImpl extends ServiceImpl<CommissionRatioMapper, CommissionRatio> implements CommissionRatioService {
|
||||||
|
|
||||||
|
|
||||||
|
private final RedisCache redisCache;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CommissionRatioVo> ratioList() {
|
public List<CommissionRatioVo> ratioList() {
|
||||||
List<CommissionRatio> list = baseMapper.selectList(null);
|
List<CommissionRatio> list = baseMapper.selectList(null);
|
||||||
|
@ -41,7 +45,10 @@ public class CommissionRatioServiceImpl extends ServiceImpl<CommissionRatioMappe
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
commissionRatio.setRatio(ratio);
|
commissionRatio.setRatio(ratio);
|
||||||
baseMapper.insert(commissionRatio);
|
baseMapper.updateById(commissionRatio);
|
||||||
|
|
||||||
|
redisCache.deleteObject("CommissionRationInviterUser");
|
||||||
|
redisCache.deleteObject("CommissionRationMerchant");
|
||||||
|
|
||||||
return this.getCommissionRatioVo(commissionRatio);
|
return this.getCommissionRatioVo(commissionRatio);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,4 +30,8 @@ public class AliConfig {
|
||||||
private String gatewayUrl;
|
private String gatewayUrl;
|
||||||
@Value("${mall.mgt.aliPayConfig.notifyUrl}")
|
@Value("${mall.mgt.aliPayConfig.notifyUrl}")
|
||||||
private String notifyUrl;
|
private String notifyUrl;
|
||||||
|
@Value("${mall.mgt.aliPayConfig.identityType}")
|
||||||
|
private String identityType;
|
||||||
|
@Value("${mall.mgt.aliPayConfig.oauthUrl}")
|
||||||
|
private String oauthUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.pay.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.lang.UUID;
|
import cn.hutool.core.lang.UUID;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.mail.MailUtil;
|
import cn.hutool.extra.mail.MailUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -47,6 +48,7 @@ import com.mcwl.system.service.ISysUserPayAccountService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -127,13 +129,13 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
Long productId = orderTradeDto.getProductId();
|
Long productId = orderTradeDto.getProductId();
|
||||||
|
|
||||||
if (!Optional.ofNullable(productId).isPresent()) {
|
if (!Optional.ofNullable(productId).isPresent()) {
|
||||||
throw new ServiceException("memberLevelId不能为空");
|
throw new ServiceException("memberLevelId不能为空", HttpStatus.SHOW_ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemberLevel memberLevel = memberLevelService.getById(productId);
|
MemberLevel memberLevel = memberLevelService.getById(productId);
|
||||||
|
|
||||||
if (!Optional.ofNullable(memberLevel).isPresent()) {
|
if (!Optional.ofNullable(memberLevel).isPresent()) {
|
||||||
throw new ServiceException("memberLevel不存在");
|
throw new ServiceException("memberLevel不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置orderTrade信息
|
// 设置orderTrade信息
|
||||||
|
@ -284,10 +286,19 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
|
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
|
||||||
|
String lock = redisCache.getCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
||||||
|
if (!StrUtil.isEmpty(lock)) {
|
||||||
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请勿频繁点击");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
redisCache.setCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId(), "1");
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||||
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "钱包余额不足");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化SDK
|
// 初始化SDK
|
||||||
|
@ -318,15 +329,14 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
.eq(SysUserPayAccount::getType, 0)
|
.eq(SysUserPayAccount::getType, 0)
|
||||||
.one();
|
.one();
|
||||||
if (Objects.isNull(sysUserPayAccount)) {
|
if (Objects.isNull(sysUserPayAccount)) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请先绑定支付宝账号");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请先绑定支付宝账号");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收款方信息
|
// 收款方信息
|
||||||
Participant payeeInfo = new Participant();
|
Participant payeeInfo = new Participant();
|
||||||
|
|
||||||
// 线上环境
|
|
||||||
payeeInfo.setIdentity(sysUserPayAccount.getOpenId());
|
payeeInfo.setIdentity(sysUserPayAccount.getOpenId());
|
||||||
payeeInfo.setIdentityType("ALIPAY_OPEN_ID");
|
payeeInfo.setIdentityType(aliConfig.getIdentityType());
|
||||||
model.setPayeeInfo(payeeInfo);
|
model.setPayeeInfo(payeeInfo);
|
||||||
|
|
||||||
request.setBizModel(model);
|
request.setBizModel(model);
|
||||||
|
@ -349,10 +359,14 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
|
|
||||||
String content = String.format("账户余额不足:用户%s提现%s", sysUser.getNickName(), amount);
|
String content = String.format("账户余额不足:用户%s提现%s", sysUser.getNickName(), amount);
|
||||||
MailUtil.send(tos, "魔创未来", content, false);
|
MailUtil.send(tos, "魔创未来", content, false);
|
||||||
throw new ServiceException("网络连接出错,请稍后再试");
|
throw new ServiceException("网络连接出错,请稍后再试", HttpStatus.SHOW_ERROR_MSG);
|
||||||
}
|
}
|
||||||
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
|
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
|
||||||
throw new ServiceException("提现失败");
|
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
|
||||||
|
} finally {
|
||||||
|
redisCache.deleteObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -376,7 +390,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
|
|
||||||
// 如果数据库中不存在该订单, 则返回订单不存在
|
// 如果数据库中不存在该订单, 则返回订单不存在
|
||||||
if (Objects.isNull(orderTrade)) {
|
if (Objects.isNull(orderTrade)) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"订单不存在");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "订单不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -403,7 +417,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("buyer_pay_amount", tradStatus.getBuyerPayAmount());
|
params.put("buyer_pay_amount", tradStatus.getBuyerPayAmount());
|
||||||
params.put("out_trade_no", tradStatus.getOutTradeNo());
|
params.put("out_trade_no", tradStatus.getOutTradeNo());
|
||||||
params.put("gmt_payment",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, tradStatus.getSendPayDate()));
|
params.put("gmt_payment", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, tradStatus.getSendPayDate()));
|
||||||
params.put("total_amount", tradStatus.getTotalAmount());
|
params.put("total_amount", tradStatus.getTotalAmount());
|
||||||
params.put("trade_no", tradStatus.getTradeNo());
|
params.put("trade_no", tradStatus.getTradeNo());
|
||||||
String code = orderTrade.getCode();
|
String code = orderTrade.getCode();
|
||||||
|
@ -440,6 +454,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
// 支付宝用户唯一ID
|
// 支付宝用户唯一ID
|
||||||
String openId = response.getOpenId();
|
String openId = response.getOpenId();
|
||||||
|
String uid = response.getUserId();
|
||||||
// 判断是否已经绑定过
|
// 判断是否已经绑定过
|
||||||
SysUserPayAccount sysUserPayAccount = sysUserPayAccountService.lambdaQuery()
|
SysUserPayAccount sysUserPayAccount = sysUserPayAccountService.lambdaQuery()
|
||||||
.eq(SysUserPayAccount::getUserId, userId)
|
.eq(SysUserPayAccount::getUserId, userId)
|
||||||
|
@ -450,12 +465,12 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
// 已经绑定过,直接返回
|
// 已经绑定过,直接返回
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
System.out.println("绑定成功!openId:" + openId);
|
System.out.println("绑定成功!openId/uid:" + openId);
|
||||||
// 将openId与当前商城用户绑定(保存到数据库)
|
// 将openId与当前商城用户绑定(保存到数据库)
|
||||||
SysUserPayAccount userPayAccount = new SysUserPayAccount();
|
SysUserPayAccount userPayAccount = new SysUserPayAccount();
|
||||||
userPayAccount.setUserId(userId);
|
userPayAccount.setUserId(userId);
|
||||||
userPayAccount.setAppId(aliConfig.getAppId());
|
userPayAccount.setAppId(aliConfig.getAppId());
|
||||||
userPayAccount.setOpenId(openId);
|
userPayAccount.setOpenId(StrUtil.isEmpty(openId) ? uid : openId);
|
||||||
userPayAccount.setType(0);
|
userPayAccount.setType(0);
|
||||||
sysUserPayAccountService.save(userPayAccount);
|
sysUserPayAccountService.save(userPayAccount);
|
||||||
redisCache.setCacheObject("alipay:bind:user:status:" + userId, "1", 4, TimeUnit.SECONDS);
|
redisCache.setCacheObject("alipay:bind:user:status:" + userId, "1", 4, TimeUnit.SECONDS);
|
||||||
|
@ -527,6 +542,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
sysUserPayAccountLog.setUserId(sysUser.getUserId());
|
sysUserPayAccountLog.setUserId(sysUser.getUserId());
|
||||||
sysUserPayAccountLog.setAmount(Double.valueOf(amount));
|
sysUserPayAccountLog.setAmount(Double.valueOf(amount));
|
||||||
sysUserPayAccountLog.setAccount("支付宝");
|
sysUserPayAccountLog.setAccount("支付宝");
|
||||||
|
sysUserPayAccountLog.setWallet(sysUser.getWallet());
|
||||||
sysUserPayAccountLogService.save(sysUserPayAccountLog);
|
sysUserPayAccountLogService.save(sysUserPayAccountLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
@ -114,6 +115,19 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
||||||
.expireAfterAccess(3, TimeUnit.MINUTES)
|
.expireAfterAccess(3, TimeUnit.MINUTES)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
CommissionRatio commissionRatio1 = commissionRatioService.lambdaQuery()
|
||||||
|
.eq(CommissionRatio::getType, 0)
|
||||||
|
.one();
|
||||||
|
CommissionRatio commissionRatio2 = commissionRatioService.lambdaQuery()
|
||||||
|
.eq(CommissionRatio::getType, 1)
|
||||||
|
.one();
|
||||||
|
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1.getRatio().toString());
|
||||||
|
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2.getRatio().toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void productHandler(ProductRes productRes) {
|
public void productHandler(ProductRes productRes) {
|
||||||
|
@ -676,6 +690,7 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
||||||
.eq(CommissionRatio::getType, 1)
|
.eq(CommissionRatio::getType, 1)
|
||||||
.one();
|
.one();
|
||||||
CommissionRationMerchant = commissionRatio.getRatio().toString();
|
CommissionRationMerchant = commissionRatio.getRatio().toString();
|
||||||
|
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), CommissionRationMerchant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 佣金配给邀请者用户比例
|
// 佣金配给邀请者用户比例
|
||||||
|
@ -685,6 +700,7 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
||||||
.eq(CommissionRatio::getType, 0)
|
.eq(CommissionRatio::getType, 0)
|
||||||
.one();
|
.one();
|
||||||
commissionRationInviterUser = commissionRatio.getRatio().toString();
|
commissionRationInviterUser = commissionRatio.getRatio().toString();
|
||||||
|
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRationInviterUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
Double rationMerchant = redisCache.getCacheObject(CommissionRationMerchant);
|
Double rationMerchant = redisCache.getCacheObject(CommissionRationMerchant);
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
sys_user u ON mil.user_id = u.user_id
|
sys_user u ON mil.user_id = u.user_id
|
||||||
WHERE
|
WHERE
|
||||||
mil.user_id = #{userId}
|
mil.user_id = #{userId}
|
||||||
|
and mil.del_flag = '0' and mi.del_flag = '0' and u.del_flag = '0'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
<choose>
|
<choose>
|
||||||
<when test="orderByColumn == 'create_time'">
|
<when test="orderByColumn == 'create_time'">
|
||||||
|
|
|
@ -132,6 +132,7 @@
|
||||||
ON ml.user_id = u.user_id
|
ON ml.user_id = u.user_id
|
||||||
WHERE
|
WHERE
|
||||||
ml.user_id = #{userId}
|
ml.user_id = #{userId}
|
||||||
|
and ml.del_flag = '0' and m.del_flag = '0' and u.del_flag = '0'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
<choose>
|
<choose>
|
||||||
<when test="orderByColumn == 'create_time'">
|
<when test="orderByColumn == 'create_time'">
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
ON wfl.user_id = u.user_id
|
ON wfl.user_id = u.user_id
|
||||||
WHERE
|
WHERE
|
||||||
wfl.user_id = #{userId}
|
wfl.user_id = #{userId}
|
||||||
|
and wfl.del_flag = '0' and wf.del_flag = '0' and u.del_flag = '0'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
<choose>
|
<choose>
|
||||||
<when test="orderByColumn == 'create_time'">
|
<when test="orderByColumn == 'create_time'">
|
||||||
|
|
|
@ -28,5 +28,9 @@ public class SysUserPayAccountLog extends BaseEntity {
|
||||||
* 提现账户
|
* 提现账户
|
||||||
*/
|
*/
|
||||||
private String account;
|
private String account;
|
||||||
|
/**
|
||||||
|
* 剩余金币
|
||||||
|
*/
|
||||||
|
private Double wallet;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class SysUserPayAccountLogServiceImpl extends ServiceImpl<SysUserPayAccou
|
||||||
|
|
||||||
baseMapper.selectPage(page, new LambdaQueryWrapper<SysUserPayAccountLog>()
|
baseMapper.selectPage(page, new LambdaQueryWrapper<SysUserPayAccountLog>()
|
||||||
.select(SysUserPayAccountLog::getAmount, SysUserPayAccountLog::getAccount, SysUserPayAccountLog::getCreateTime)
|
.select(SysUserPayAccountLog::getAmount, SysUserPayAccountLog::getAccount, SysUserPayAccountLog::getCreateTime)
|
||||||
.eq(SysUserPayAccountLog::getUserId, userId));
|
.eq(SysUserPayAccountLog::getUserId, userId)
|
||||||
|
.orderByDesc(SysUserPayAccountLog::getCreateTime));
|
||||||
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
rspData.setCode(HttpStatus.SUCCESS);
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
|
|
Loading…
Reference in New Issue