Commit c38cd095 by 吕明尚

修改充值回调

parent aefc088e
...@@ -355,23 +355,20 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -355,23 +355,20 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setCreateTime(new Date()); memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue())); memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
memberProgressLogService.save(memberProgressLog); memberProgressLogService.save(memberProgressLog);
MemberConfig newOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>() List<MemberConfig> list = memberConfigService.list(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, one.getMemberType())
.eq(MemberConfig::getMembershipLevel, one.getMembershipLevel() + 1L));
MemberConfig newTwo = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, one.getMemberType()) .eq(MemberConfig::getMemberType, one.getMemberType())
.eq(MemberConfig::getMembershipLevel, one.getMembershipLevel() + 2L)); .orderBy(true, false, MemberConfig::getMembershipLevel));
if (ObjectUtil.isNotEmpty(newOne) && one.getMembershipProgress().compareTo(BigDecimal.valueOf(newOne.getLimitRequirements())) >= 0) { //转Map limitRequirements,MemberConfig
if (ObjectUtil.isNotEmpty(newTwo) && one.getMembershipProgress().compareTo(BigDecimal.valueOf(newTwo.getLimitRequirements())) <= 0) { Map<Long, MemberConfig> memberConfigMap = list.stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, Function.identity()));
one.setMembershipLevel(one.getMembershipLevel() + 1L); //判断consumption[0]大于某个等级的积分,并小于下一等级的积分或者大于最大等级
one.setMemberConfigId(newOne.getId()); for (Map.Entry<Long, MemberConfig> entry : memberConfigMap.entrySet()) {
consumerMemberService.updateConsumerMember(one); if (consumption[0].compareTo(BigDecimal.valueOf(entry.getValue().getLimitRequirements())) >= 0 &&
} else { (consumption[0].compareTo(BigDecimal.valueOf(memberConfigMap.get(entry.getKey() + 1).getLimitRequirements())) < 0 ||
one.setMembershipLevel(one.getMembershipLevel() + 2L); consumption[0].compareTo(BigDecimal.valueOf(memberConfigMap.get(memberConfigMap.size()).getLimitRequirements())) >= 0)) {
one.setMemberConfigId(newTwo.getId()); one.setMembershipLevel(entry.getKey());
consumerMemberService.updateConsumerMember(one); one.setMemberConfigId(entry.getValue().getId());
consumerMemberService.updateById(one);
} }
} }
consumerWallet.setRemainingIntegral(consumerWallet.getRemainingIntegral().add(consumption[0])); consumerWallet.setRemainingIntegral(consumerWallet.getRemainingIntegral().add(consumption[0]));
consumerWalletMapper.updateConsumerWallet(consumerWallet); consumerWalletMapper.updateConsumerWallet(consumerWallet);
......
...@@ -1334,7 +1334,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1334,7 +1334,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) { if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
if (consumerMember.getMembershipLevel().compareTo(0L) > 0) { if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex()); consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) <= 0) { if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L); consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>() consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType()) .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
...@@ -1344,7 +1344,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1344,7 +1344,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) { } else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
if (consumerMember.getMembershipLevel().compareTo(0L) > 0) { if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex()); consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) <= 0) { if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L); consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>() consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType()) .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
...@@ -1357,7 +1357,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1357,7 +1357,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(one)) { if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级 //判断是否升级
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) <= 0) { if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L); consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>() consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType()) .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
......
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