Commit 2a2b97e0 by 吕明尚

权益会员配置增加赠送积分

parent 117891fc
...@@ -54,6 +54,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -54,6 +54,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired @Autowired
private ConsumerWalletService consumerWalletService; private ConsumerWalletService consumerWalletService;
@Autowired
private IntegralLogService integralLogService;
/** /**
* 查询权益会员订单 * 查询权益会员订单
...@@ -176,10 +178,21 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -176,10 +178,21 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
newConsumerMember.setMemberConfigId(memberConfig.getId()); newConsumerMember.setMemberConfigId(memberConfig.getId());
newConsumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())), newConsumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
equityMembersOrderConfig.getValidityPeriod().intValue())); equityMembersOrderConfig.getValidityPeriod().intValue()));
newConsumerMember.setMembershipProgress(BigDecimal.ZERO); newConsumerMember.setMembershipProgress(equityMembersOrderConfig.getGiftPoints());
newConsumerMember.setCreateTime(new Date()); newConsumerMember.setCreateTime(new Date());
newConsumerMember.setIsRights(YesNoEnum.yes.getIndex()); newConsumerMember.setIsRights(YesNoEnum.yes.getIndex());
consumerMemberService.save(newConsumerMember); consumerMemberService.save(newConsumerMember);
//增加积分日志
if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.ZERO) > 0) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(equityMembersOrder.getConsumerId());
integralLog.setCurrentIntegral(BigDecimal.ZERO);
integralLog.setVariableIntegral(equityMembersOrderConfig.getGiftPoints());
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setOperationTime(new Date());
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
}
logger.debug("新增权益会员"); logger.debug("新增权益会员");
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("consumerId", String.valueOf(newConsumerMember.getConsumerId())); map.put("consumerId", String.valueOf(newConsumerMember.getConsumerId()));
...@@ -193,6 +206,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -193,6 +206,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
//在原来的基础上增加有效期 //在原来的基础上增加有效期
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, consumerMember.getExpirationDate())), consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, consumerMember.getExpirationDate())),
equityMembersOrderConfig.getValidityPeriod().intValue())); equityMembersOrderConfig.getValidityPeriod().intValue()));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember);
consumerMemberService.updateConsumerMember(consumerMember); consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("权益会员原来的基础上增加有效期"); logger.debug("权益会员原来的基础上增加有效期");
} else { } else {
...@@ -204,6 +218,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -204,6 +218,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
.eq(MemberConfig::getMemberType, MemberTypeEnum.RIGHTS.getIndex())).getId()); .eq(MemberConfig::getMemberType, MemberTypeEnum.RIGHTS.getIndex())).getId());
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())), consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
equityMembersOrderConfig.getValidityPeriod().intValue())); equityMembersOrderConfig.getValidityPeriod().intValue()));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember);
consumerMemberService.updateConsumerMember(consumerMember); consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("修改会员类型为权益会员"); logger.debug("修改会员类型为权益会员");
} }
...@@ -226,6 +241,30 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -226,6 +241,30 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
updateEquityMembersOrder(equityMembersOrder); updateEquityMembersOrder(equityMembersOrder);
} }
private void extracted(EquityMembersOrder equityMembersOrder, EquityMembersOrderConfig equityMembersOrderConfig, ConsumerMember consumerMember) {
if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.ZERO) > 0) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(equityMembersOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerMember.getMembershipProgress());
integralLog.setVariableIntegral(equityMembersOrderConfig.getGiftPoints().add(consumerMember.getMembershipProgress()));
consumerMember.setMembershipProgress(equityMembersOrderConfig.getGiftPoints().add(consumerMember.getMembershipProgress()));
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setOperationTime(new Date());
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
}
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel() + 1L));
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (ObjectUtil.isNotEmpty(one) && consumerMember.getMembershipProgress().compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
}
}
}
@Override @Override
public Boolean cancelPay(String equityOrderNo) { public Boolean cancelPay(String equityOrderNo) {
EquityMembersOrder equityMembersOrder = getByEquityOrderNo(equityOrderNo); EquityMembersOrder equityMembersOrder = getByEquityOrderNo(equityOrderNo);
......
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