Commit c38cd095 by 吕明尚

修改充值回调

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