Commit 6e26c088 by YG8429

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

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