Commit e1238278 by YG8429

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	share-system/src/main/java/share/system/service/impl/SConsumerServiceImpl.java
parents c74a26ab 5d4d2f19
...@@ -701,19 +701,24 @@ public class RedisTask { ...@@ -701,19 +701,24 @@ public class RedisTask {
list.sort(Comparator.comparing(MemberProgressLog::getOperationType).reversed()); list.sort(Comparator.comparing(MemberProgressLog::getOperationType).reversed());
//获得list的consumerId //获得list的consumerId
List<Long> consumerIds = list.stream().map(MemberProgressLog::getConsumerId).distinct().collect(Collectors.toList()); List<Long> consumerIds = list.stream().map(MemberProgressLog::getConsumerId).distinct().collect(Collectors.toList());
Map<Long, ConsumerMember> consumerMemberMap = consumerMemberService.list(new LambdaQueryWrapper<ConsumerMember>().in(ConsumerMember::getConsumerId, consumerIds))
.stream().collect(Collectors.toMap(ConsumerMember::getConsumerId, item -> item));
//按照consumerId进行分组 //按照consumerId进行分组
Map<Long, List<MemberProgressLog>> collect = list.stream().collect(Collectors.groupingBy(MemberProgressLog::getConsumerId)); Map<Long, List<MemberProgressLog>> collect = list.stream().collect(Collectors.groupingBy(MemberProgressLog::getConsumerId));
Map<Long, MemberConfig> memberConfigMap = memberConfigService.list().stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, item -> item));
List<ConsumerMember> updateList = new ArrayList<>();
consumerIds.stream().forEach(item -> { consumerIds.stream().forEach(item -> {
List<MemberProgressLog> memberProgressLogs = collect.get(item); List<MemberProgressLog> memberProgressLogs = collect.get(item);
if (memberProgressLogs.size() > 0) { if (memberProgressLogs.size() > 0) {
//查询会员 //查询会员
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, item)); ConsumerMember consumerMember = consumerMemberMap.get(item);
;
if (consumerMember.getMembershipProgress().equals(BigDecimal.ZERO)) { if (consumerMember.getMembershipProgress().equals(BigDecimal.ZERO)) {
//结束此次循环 //结束此次循环
return; return;
} }
//查询会员配置 //查询会员配置
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())); MemberConfig memberConfig = memberConfigMap.get(consumerMember.getMembershipLevel());
final BigDecimal[] sum = {BigDecimal.ZERO}; final BigDecimal[] sum = {BigDecimal.ZERO};
//计算扣除进度 //计算扣除进度
memberProgressLogs.stream().forEach(log -> { memberProgressLogs.stream().forEach(log -> {
...@@ -745,9 +750,10 @@ public class RedisTask { ...@@ -745,9 +750,10 @@ public class RedisTask {
} }
} }
} }
consumerMemberService.updateConsumerMember(consumerMember); updateList.add(consumerMember);
} }
}); });
if (!CollectionUtils.isEmpty(updateList)) consumerMemberService.updateBatchById(updateList);
logger.debug("AutoProgressLog:会员等级滚动降级结束"); logger.debug("AutoProgressLog:会员等级滚动降级结束");
} }
......
...@@ -23,7 +23,9 @@ import share.common.utils.BaseUtil; ...@@ -23,7 +23,9 @@ import share.common.utils.BaseUtil;
import share.common.utils.DateUtil; import share.common.utils.DateUtil;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.system.domain.*; import share.system.domain.*;
import share.system.domain.vo.*; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MemberConfigVo;
import share.system.domain.vo.SConsumerVo;
import share.system.mapper.ConsumerMemberMapper; import share.system.mapper.ConsumerMemberMapper;
import share.system.mapper.SConsumerMapper; import share.system.mapper.SConsumerMapper;
import share.system.mapper.SStoreConsumerMapper; import share.system.mapper.SStoreConsumerMapper;
...@@ -199,6 +201,9 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -199,6 +201,9 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Override @Override
public SConsumerVo getSConsumer() { public SConsumerVo getSConsumer() {
SConsumer currentUser = getInfo(); SConsumer currentUser = getInfo();
if (ObjectUtil.isNull(currentUser)) {
throw new BaseException("您的登录已过期,请先登录");
}
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon(); SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(currentUser.getId()); sConsumerCoupon.setConsumerId(currentUser.getId());
sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode()); sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode());
...@@ -275,9 +280,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -275,9 +280,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
} }
if (ObjectUtil.isNull(currentUser)) {
throw new BaseException("您的登录已过期,请先登录");
}
return vo; return vo;
} }
......
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