Commit 6e26c088 by YG8429

修改权益会员绑定逻辑。权益会员返佣逻辑

parent a81e99d0
......@@ -401,8 +401,8 @@ public class RedisTask {
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper);
//判断是否为权益会员和会员是否有效
if ("2".equals(consumerMember.getMemberType()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
&& "2".equals(newConsumerMember.getMemberType()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRecharge()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
&& YesNoEnum.yes.getIndex().equals(newConsumerMember.getIsRecharge()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().toString());
if (aBoolean && newAboolean) {
......
......@@ -470,7 +470,7 @@ public class CallbackServiceImpl implements CallbackService {
wechatInfo.setTradeStateDesc("支付成功");
wechatPayInfoService.updateById(wechatInfo);
//新增权益金日志
addEquityFundLogRecharge(recharge.getConsumerId(),
addEquityFundLog(recharge.getConsumerId(),
recharge.getRechargeAmount(),recharge.getOutTradeNo(),recharge.getTerminalTrace(),"0");
aFalse = Boolean.TRUE;
} catch (Exception e) {
......@@ -552,7 +552,7 @@ public class CallbackServiceImpl implements CallbackService {
equityPayInfo.setTradeStateDesc("支付成功");
wechatPayInfoService.updateById(equityPayInfo);
//新增权益金日志
addEquityFundLogRights(equityMembersOrder.getConsumerId(),
addEquityFundLog(equityMembersOrder.getConsumerId(),
equityMembersOrder.getPayPrice(),equityMembersOrder.getEquityOrderNo(),equityMembersOrder.getTerminalTrace(),"1");
aBoolean = Boolean.TRUE;
} catch (Exception e) {
......@@ -765,11 +765,10 @@ public class CallbackServiceImpl implements CallbackService {
* @param terminalTrace 终端流水号
* @param type 权益类型
*/
private void addEquityFundLogRecharge(Long consumerId, BigDecimal payPrice, String equityOrderNo, String terminalTrace, String type) {
private void addEquityFundLog(Long consumerId, BigDecimal payPrice, String equityOrderNo, String terminalTrace, String type) {
//查询是否有上级
SharingActivities sharingActivities = sharingActivitiesService.getOne(new LambdaQueryWrapper<SharingActivities>()
.eq(SharingActivities::getNewUid, consumerId)
.eq(SharingActivities::getActivityType, "1")
.eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex()));
if (ObjectUtil.isNotEmpty(sharingActivities)) {
//查询会员用户类型
......@@ -777,7 +776,7 @@ public class CallbackServiceImpl implements CallbackService {
consumerMemberLambdaQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
//判断是否为权益会员和会员是否有效
if ("2".equals(consumerMember.getMemberType()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()) {
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRecharge()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
if (aBoolean) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
......@@ -826,79 +825,79 @@ public class CallbackServiceImpl implements CallbackService {
}
}
}
/**
* 新增权益金日志
* @param consumerId 用户ID
* @param payPrice 消费金额
* @param equityOrderNo 订单编号
* @param terminalTrace 终端流水号
* @param type 权益类型
*/
private void addEquityFundLogRights(Long consumerId, BigDecimal payPrice, String equityOrderNo, String terminalTrace, String type) {
//查询是否有上级
SharingActivities sharingActivities = sharingActivitiesService.getOne(new LambdaQueryWrapper<SharingActivities>()
.eq(SharingActivities::getNewUid, consumerId)
.eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex()));
if (ObjectUtil.isNotEmpty(sharingActivities)) {
//查询会员用户类型
LambdaQueryWrapper<ConsumerMember> consumerMemberWrapper = new LambdaQueryWrapper<>();
consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
LambdaQueryWrapper<ConsumerMember> newConsumerMemberWrapper = new LambdaQueryWrapper<>();
newConsumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberWrapper);
//判断是否为权益会员和会员是否有效
if ("2".equals(consumerMember.getMemberType()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
&& "2".equals(newConsumerMember.getMemberType()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().toString());
if (aBoolean && newAboolean) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
//查询上级用户是否有钱包
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
if (ObjectUtil.isNotEmpty(consumerWallet)) {
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund))));
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
add(payPrice.multiply(new BigDecimal(equityFund))));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
} else {
//新增钱包
ConsumerWallet newConsumerWallet = new ConsumerWallet();
BigDecimal defaultVlue = new BigDecimal(0.0);
newConsumerWallet.setConsumerId(sharingActivities.getUid());
newConsumerWallet.setBalance(defaultVlue);
newConsumerWallet.setRemainingIntegral(defaultVlue);
newConsumerWallet.setRemainingDuration(defaultVlue);
newConsumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
newConsumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund()
.add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
consumerWalletService.insertConsumerWallet(newConsumerWallet);
}
//添加权益金日志记录
//下级用户
SConsumer newConsumer = consumerService.getById(consumerId);
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
equityFundLog.setEquityFundType(type);
equityFundLog.setOutTradeNo(equityOrderNo);
equityFundLog.setTerminalTrace(terminalTrace);
equityFundLog.setUid(sharingActivities.getUid());
equityFundLog.setNewUid(sharingActivities.getNewUid());
equityFundLog.setPhone(consumer.getPhone());
equityFundLog.setAccount(consumer.getAccount());
equityFundLog.setNickName(consumer.getNickName());
equityFundLog.setNewPhone(newConsumer.getPhone());
equityFundLog.setNewAccount(newConsumer.getAccount());
equityFundLog.setNewNickName(newConsumer.getNickName());
equityFundLogService.insertEquityFundLog(equityFundLog);
}
}
}
}
// /**
// * 新增权益金日志
// * @param consumerId 用户ID
// * @param payPrice 消费金额
// * @param equityOrderNo 订单编号
// * @param terminalTrace 终端流水号
// * @param type 权益类型
// */
// private void addEquityFundLogRights(Long consumerId, BigDecimal payPrice, String equityOrderNo, String terminalTrace, String type) {
// //查询是否有上级
// SharingActivities sharingActivities = sharingActivitiesService.getOne(new LambdaQueryWrapper<SharingActivities>()
// .eq(SharingActivities::getNewUid, consumerId)
// .eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex()));
// if (ObjectUtil.isNotEmpty(sharingActivities)) {
// //查询会员用户类型
// LambdaQueryWrapper<ConsumerMember> consumerMemberWrapper = new LambdaQueryWrapper<>();
// consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
// ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
// LambdaQueryWrapper<ConsumerMember> newConsumerMemberWrapper = new LambdaQueryWrapper<>();
// newConsumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
// ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberWrapper);
// //判断是否为权益会员和会员是否有效
// if ("2".equals(consumerMember.getMemberType()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
// && "2".equals(newConsumerMember.getMemberType()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
// Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
// Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().toString());
// if (aBoolean && newAboolean) {
// String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
// //查询上级用户是否有钱包
// ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
// .eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
// if (ObjectUtil.isNotEmpty(consumerWallet)) {
// consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund))));
// consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
// add(payPrice.multiply(new BigDecimal(equityFund))));
// consumerWallet.setUpdateTime(DateUtils.getNowDate());
// consumerWalletService.updateConsumerWallet(consumerWallet);
// } else {
// //新增钱包
// ConsumerWallet newConsumerWallet = new ConsumerWallet();
// BigDecimal defaultVlue = new BigDecimal(0.0);
// newConsumerWallet.setConsumerId(sharingActivities.getUid());
// newConsumerWallet.setBalance(defaultVlue);
// newConsumerWallet.setRemainingIntegral(defaultVlue);
// newConsumerWallet.setRemainingDuration(defaultVlue);
// newConsumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
// newConsumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund()
// .add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
// consumerWalletService.insertConsumerWallet(newConsumerWallet);
// }
// //添加权益金日志记录
// //下级用户
// SConsumer newConsumer = consumerService.getById(consumerId);
// //上级用户
// SConsumer consumer = consumerService.getById(sharingActivities.getUid());
// EquityFundLog equityFundLog = new EquityFundLog();
// equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
// equityFundLog.setEquityFundType(type);
// equityFundLog.setOutTradeNo(equityOrderNo);
// equityFundLog.setTerminalTrace(terminalTrace);
// equityFundLog.setUid(sharingActivities.getUid());
// equityFundLog.setNewUid(sharingActivities.getNewUid());
// equityFundLog.setPhone(consumer.getPhone());
// equityFundLog.setAccount(consumer.getAccount());
// equityFundLog.setNickName(consumer.getNickName());
// equityFundLog.setNewPhone(newConsumer.getPhone());
// equityFundLog.setNewAccount(newConsumer.getAccount());
// equityFundLog.setNewNickName(newConsumer.getNickName());
// equityFundLogService.insertEquityFundLog(equityFundLog);
// }
// }
// }
// }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment