Commit d091fad4 by wuwenlong

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

parents 49963cde 0af5093a
...@@ -52,6 +52,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -52,6 +52,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private MemberConfigService memberConfigService; private MemberConfigService memberConfigService;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private ConsumerWalletService consumerWalletService;
/** /**
* 查询权益会员订单 * 查询权益会员订单
...@@ -160,6 +162,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -160,6 +162,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
@Override @Override
public void paymentSuccessful(EquityMembersOrder equityMembersOrder) { public void paymentSuccessful(EquityMembersOrder equityMembersOrder) {
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, equityMembersOrder.getConsumerId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, equityMembersOrder.getConsumerId()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, equityMembersOrder.getConsumerId()));
EquityMembersOrderConfig equityMembersOrderConfig = equityMembersOrderConfigService.selectEquityMembersOrderConfigById(equityMembersOrder.getEquityMembersConfigId()); EquityMembersOrderConfig equityMembersOrderConfig = equityMembersOrderConfigService.selectEquityMembersOrderConfigById(equityMembersOrder.getEquityMembersConfigId());
if (ObjectUtil.isEmpty(consumerMember)) { if (ObjectUtil.isEmpty(consumerMember)) {
ConsumerMember newConsumerMember = new ConsumerMember(); ConsumerMember newConsumerMember = new ConsumerMember();
...@@ -210,6 +213,15 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde ...@@ -210,6 +213,15 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
JSONObject json = new JSONObject(map); JSONObject json = new JSONObject(map);
redisUtil.set(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + equityMembersOrder.getConsumerId(), json.toString()); redisUtil.set(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + equityMembersOrder.getConsumerId(), json.toString());
} }
if (ObjectUtil.isEmpty(consumerWallet)) {
ConsumerWallet consumerWalletOne = new ConsumerWallet();
consumerWalletOne.setConsumerId(equityMembersOrder.getConsumerId());
consumerWalletOne.setBalance(BigDecimal.ZERO);
consumerWalletOne.setRemainingDuration(BigDecimal.ZERO);
consumerWalletOne.setRemainingIntegral(BigDecimal.ZERO);
consumerWalletOne.setCreateTime(new Date());
consumerWalletService.save(consumerWalletOne);
}
updateEquityMembersOrder(equityMembersOrder); updateEquityMembersOrder(equityMembersOrder);
} }
......
...@@ -1122,14 +1122,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1122,14 +1122,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(sOrder.getCouponId())) { if (ObjectUtil.isNotEmpty(sOrder.getCouponId())) {
coupon = consumerCouponService.getById(sOrder.getCouponId()); coupon = consumerCouponService.getById(sOrder.getCouponId());
} }
BigDecimal integral = BigDecimal.ZERO;
IntegralLog integralLog = new IntegralLog(); BigDecimal membershipProgress = BigDecimal.ZERO;
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral;
BigDecimal membershipProgress;
if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) { if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) {
integral = consumerWallet.getRemainingIntegral().add(coupon.getCouponPayPrice()).add(sOrder.getBalance()); if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral().add(coupon.getCouponPayPrice()).add(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance()) membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance())
.add(coupon.getCouponPayPrice()); .add(coupon.getCouponPayPrice());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) { if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
...@@ -1137,20 +1135,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1137,20 +1135,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
membershipProgress = membershipProgress.add(sOrder.getPayPrice()); membershipProgress = membershipProgress.add(sOrder.getPayPrice());
} }
} else { } else {
integral = consumerWallet.getRemainingIntegral().add(sOrder.getBalance()); if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral().add(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance()); membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) { if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
integral = integral.add(sOrder.getPayPrice()); integral = integral.add(sOrder.getPayPrice());
membershipProgress = membershipProgress.add(sOrder.getPayPrice()); membershipProgress = membershipProgress.add(sOrder.getPayPrice());
} }
} }
if (ObjectUtil.isNotEmpty(consumerWallet)) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
integralLog.setVariableIntegral(integral.subtract(consumerWallet.getRemainingIntegral())); integralLog.setVariableIntegral(integral.subtract(consumerWallet.getRemainingIntegral()));
consumerWallet.setRemainingIntegral(integral); consumerWallet.setRemainingIntegral(integral);
integralLog.setOperationType(YesNoEnum.yes.getIndex()); integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setOperationTime(new Date()); integralLog.setOperationTime(new Date());
integralLog.setCreateTime(new Date()); integralLog.setCreateTime(new Date());
integralLogService.save(integralLog); integralLogService.save(integralLog);
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
}
MemberProgressLog memberProgressLog = new MemberProgressLog(); MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId()); memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress()); memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
...@@ -1271,14 +1276,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1271,14 +1276,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(sOrder.getCouponId())) { if (ObjectUtil.isNotEmpty(sOrder.getCouponId())) {
coupon = consumerCouponService.getById(sOrder.getCouponId()); coupon = consumerCouponService.getById(sOrder.getCouponId());
} }
IntegralLog integralLog = new IntegralLog(); BigDecimal integral = BigDecimal.ZERO;
integralLog.setConsumerId(sOrder.getConsumerId()); BigDecimal membershipProgress = BigDecimal.ZERO;
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral;
BigDecimal membershipProgress;
if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) { if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) {
integral = consumerWallet.getRemainingIntegral() if (ObjectUtil.isNotEmpty(consumerWallet)) {
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice()); integral = consumerWallet.getRemainingIntegral()
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice());
}
membershipProgress = consumerMember.getMembershipProgress() membershipProgress = consumerMember.getMembershipProgress()
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice()); .subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) { if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
...@@ -1286,7 +1293,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1286,7 +1293,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
membershipProgress = membershipProgress.subtract(sOrder.getPayPrice()); membershipProgress = membershipProgress.subtract(sOrder.getPayPrice());
} }
} else { } else {
integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getBalance()); if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().subtract(sOrder.getBalance()); membershipProgress = consumerMember.getMembershipProgress().subtract(sOrder.getBalance());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) { if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
integral = integral.subtract(sOrder.getPayPrice()); integral = integral.subtract(sOrder.getPayPrice());
...@@ -1294,13 +1303,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1294,13 +1303,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
integralLog.setVariableIntegral(consumerWallet.getRemainingIntegral().subtract(integral)); if (ObjectUtil.isNotEmpty(consumerWallet)) {
consumerWallet.setRemainingIntegral(integral); IntegralLog integralLog = new IntegralLog();
integralLog.setOperationType(YesNoEnum.no.getIndex()); integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setOperationTime(new Date()); integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
integralLog.setCreateTime(new Date()); integralLog.setVariableIntegral(consumerWallet.getRemainingIntegral().subtract(integral));
integralLogService.save(integralLog); integralLog.setOperationType(YesNoEnum.no.getIndex());
consumerWalletService.updateById(consumerWallet); integralLog.setOperationTime(new Date());
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
consumerWallet.setRemainingIntegral(integral);
consumerWalletService.updateById(consumerWallet);
}
MemberProgressLog memberProgressLog = new MemberProgressLog(); MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId()); memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress()); memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
...@@ -2463,6 +2477,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2463,6 +2477,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setMemberDiscount(BigDecimal.ZERO); priceResponse.setMemberDiscount(BigDecimal.ZERO);
priceResponse.setTotalFee(payPrice); priceResponse.setTotalFee(payPrice);
priceResponse.setTotalFeeNow(payPrice); priceResponse.setTotalFeeNow(payPrice);
// priceResponse.setDiscount(BigDecimal.ZERO);
SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId()); SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId());
computedCouponPrice(request, priceResponse, user, consumerCoupon); computedCouponPrice(request, priceResponse, user, consumerCoupon);
priceResponse.setDuration(new BigDecimal(0)); priceResponse.setDuration(new BigDecimal(0));
...@@ -2475,6 +2490,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2475,6 +2490,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
BigDecimal payFee = priceResponse.getPayFee(); BigDecimal payFee = priceResponse.getPayFee();
BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
if (payFee.compareTo(divide) == 0) {
priceResponse.setDiscount(BigDecimal.ZERO);
}
//总金额乘以折扣比例除以100 //总金额乘以折扣比例除以100
priceResponse.setPayFee(divide); priceResponse.setPayFee(divide);
priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee())); priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
...@@ -2498,7 +2516,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2498,7 +2516,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
priceResponse.setPayFee(totalFee); priceResponse.setPayFee(totalFee);
} }
if (ObjectUtil.isEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isEmpty(consumerWallet) && ObjectUtil.isEmpty(consumerMember)) {
priceResponse.setTotalFeeNow(priceResponse.getPayFee()); priceResponse.setTotalFeeNow(priceResponse.getPayFee());
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(priceResponse.getPayFee())); priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
} }
...@@ -2706,7 +2724,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2706,7 +2724,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreEndDate().toInstant(), ZoneId.systemDefault())); boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreEndDate().toInstant(), ZoneId.systemDefault()));
if (match && match1 if (match && match1
&& item.getDuration().compareTo(BigDecimal.ZERO) == 0 && item.getDuration().compareTo(BigDecimal.ZERO) == 0
&& (item.getPayPrice().add(item.getBalance())).divide(item.getTotalPrice(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).compareTo(activity.getDiscountRatio()) == 0 && (item.getPayPrice().add(item.getBalance())).divide(item.getTotalPrice(), 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100)).compareTo(activity.getDiscountRatio()) == 0
) { ) {
i.getAndIncrement(); i.getAndIncrement();
} }
......
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